moving on

This commit is contained in:
friendica 2013-02-18 15:15:55 -08:00
parent a21e6cffa1
commit 65912ec0bf
11 changed files with 187 additions and 6 deletions

View File

@ -16,7 +16,7 @@ require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1029 );
define ( 'DB_UPDATE_VERSION', 1030 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -153,6 +153,66 @@ function channel_remove($channel_id) {
}
function remove_all_xchan_resources($xchan, $channel_id = 0) {
if(intval($channel_id)) {
}
else {
// this is somewhat destructive
// FIXME
// We don't want to be quite as destructive on directories, which will need to mirror the action
// and we also don't want to completely destroy an xchan that has moved to a new primary location
$r = q("delete from photo where xchan = '%s'",
dbesc($xchan)
);
$r = q("select resource_id, resource_type, uid, id from item where ( author_xchan = '%s' or owner_xchan = '%s' ) ",
dbesc($xchan),
dbesc($xchan)
);
if($r) {
foreach($r as $rr) {
drop_item($rr,false);
}
}
$r = q("delete from event where event_xchan = '%s'",
dbesc($xchan)
);
$r = q("delete from group_member where xchan = '%s'",
dbesc($xchan)
);
$r = q("delete from mail where ( from_xchan = '%s' or to_xchan = '%s' )",
dbesc($xchan),
dbesc($xchan)
);
$r = q("delete from xlink where ( xlink_xchan = '%s' or xlink_link = '%s' )",
dbesc($xchan),
dbesc($xchan)
);
$r = q("delete from xchan where xchan_hash = '%s' limit 1",
dbesc($xchan)
);
$r = q("delete from hubloc where hubloc_hash = '%s'",
dbesc($xchan)
);
$r = q("delete from abook where abook_xchan = '%s'",
dbesc($xchan)
);
$r = q("delete from xtag where xtag_hash = '%s'",
dbesc($xchan)
);
}
}
function contact_remove($channel_id, $abook_id) {

View File

@ -20,8 +20,8 @@ function gprobe_run($argv, $argc){
if(! $r) {
$x = zot_finger($url,null);
if($x) {
$j = json_decode($x,true);
if($x['success']) {
$j = json_decode($x['body'],true);
$y = import_xchan($j);
}
}

View File

@ -4265,6 +4265,14 @@ function delete_item_lowlevel($item) {
intval($item['uid'])
);
q("delete from term where oid = %d and otype = %d",
intval($item['id']),
intval(TERM_OBJ_POST)
);
// FIXME remove notifications for this item
return true;
}

View File

@ -153,6 +153,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_prvkey` text NOT NULL,
`channel_notifyflags` int(10) unsigned NOT NULL DEFAULT '65535',
`channel_pageflags` int(10) unsigned NOT NULL DEFAULT '0',
`channel_deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`channel_max_anon_mail` int(10) unsigned NOT NULL DEFAULT '10',
`channel_max_friend_req` int(10) unsigned NOT NULL DEFAULT '10',
`channel_expire_days` int(11) NOT NULL DEFAULT '0',
@ -209,7 +210,8 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_r_storage` (`channel_r_storage`),
KEY `channel_w_storage` (`channel_w_storage`),
KEY `channel_r_pages` (`channel_r_pages`),
KEY `channel_w_pages` (`channel_w_pages`)
KEY `channel_w_pages` (`channel_w_pages`),
KEY `channel_deleted` (`channel_deleted`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `clients` (

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1029 );
define( 'UPDATE_VERSION' , 1030 );
/**
*
@ -357,3 +357,11 @@ ADD INDEX ( `xlink_rating` ) ");
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1029() {
$r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_pageflags` ,
ADD INDEX ( `channel_deleted` ) ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -236,6 +236,31 @@ function post_post(&$a) {
if(array_key_exists('recipients',$data))
$recipients = $data['recipients'];
if($msgtype === 'purge') {
if($recipients) {
// basically this means "unfriend"
foreach($recipients as $recip) {
}
}
else {
// basically this means the channel has committed suicide
$arr = $data['sender'];
$sender_hash = base64url_encode(hash('whirlpool',$arr['guid'] . $arr['guid_sig'], true));
require_once('include/Contact.php');
remove_all_xchan_resources($sender_hash);
$ret['result'] = true;
json_return_and_die($ret);
}
}
if($msgtype === 'refresh') {
// remote channel info (such as permissions or photo or something)

View File

@ -1 +1 @@
2013-02-16.226
2013-02-18.228

View File

@ -20,4 +20,7 @@ section {
left: 250px;
display: block;
right: 15px;
padding-bottom: 350px;
}

View File

@ -0,0 +1,35 @@
<h2>$title</h2>
<form action="import" method="post" id="import-channel-form">
<div id="import-desc" class="descriptive-paragraph">$desc</div>
<label for="import-filename" id="label-import-filename" class="import-label" >$label_filename</label>
<input type="file" name="filename" id="import-filename" class="import-input" value="" />
<div id="import-filename-end" class="import-field-end"></div>
<div id="import-choice" class="descriptive-paragraph">$choice</div>
<label for="import-old-address" id="label-import-old-address" class="import-label" >$label_old_address</label>
<input type="text" name="old_address" id="import-old-address" class="import-input" value="" />
<div id="import-old-address-end" class="import-field-end"></div>
<label for="import-old-email" id="label-import-old-email" class="import-label" >$label_old_email</label>
<input type="text" name="email" id="import-old-email" class="import-input" value="$email" />
<div id="import-old-email-end" class="import-field-end"></div>
<label for="import-old-pass" id="label-import-old-pass" class="import-label" >$label_old_pass</label>
<input type="password" name="password" id="import-old-pass" class="import-input" value="$pass" />
<div id="import-old-pass-end" class="import-field-end"></div>
<div id="import-common-desc" class="descriptive-paragraph">$common</div>
<input type="checkbox" name="make_primary" id="import-make-primary" value="1" />
<label for="import-make-primary" id="label-import-make-primary">$label_import_primary</label>
<div id="import-make-primary-end" class="import-field-end"></div>
<input type="submit" name="submit" id="import-submit-button" value="$submit" />
<div id="import-submit-end" class="import-field-end"></div>
</form>

View File

@ -0,0 +1,40 @@
{{*
* AUTOMATICALLY GENERATED TEMPLATE
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<h2>{{$title}}</h2>
<form action="import" method="post" id="import-channel-form">
<div id="import-desc" class="descriptive-paragraph">{{$desc}}</div>
<label for="import-filename" id="label-import-filename" class="import-label" >{{$label_filename}}</label>
<input type="file" name="filename" id="import-filename" class="import-input" value="" />
<div id="import-filename-end" class="import-field-end"></div>
<div id="import-choice" class="descriptive-paragraph">{{$choice}}</div>
<label for="import-old-address" id="label-import-old-address" class="import-label" >{{$label_old_address}}</label>
<input type="text" name="old_address" id="import-old-address" class="import-input" value="" />
<div id="import-old-address-end" class="import-field-end"></div>
<label for="import-old-email" id="label-import-old-email" class="import-label" >{{$label_old_email}}</label>
<input type="text" name="email" id="import-old-email" class="import-input" value="{{$email}}" />
<div id="import-old-email-end" class="import-field-end"></div>
<label for="import-old-pass" id="label-import-old-pass" class="import-label" >{{$label_old_pass}}</label>
<input type="password" name="password" id="import-old-pass" class="import-input" value="{{$pass}}" />
<div id="import-old-pass-end" class="import-field-end"></div>
<div id="import-common-desc" class="descriptive-paragraph">{{$common}}</div>
<input type="checkbox" name="make_primary" id="import-make-primary" value="1" />
<label for="import-make-primary" id="label-import-make-primary">{{$label_import_primary}}</label>
<div id="import-make-primary-end" class="import-field-end"></div>
<input type="submit" name="submit" id="import-submit-button" value="{{$submit}}" />
<div id="import-submit-end" class="import-field-end"></div>
</form>