update author name across items if changed.
This commit is contained in:
parent
cb9d0993f1
commit
a3cf563b68
2
boot.php
2
boot.php
|
@ -11,7 +11,7 @@ require_once('include/cache.php');
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_VERSION', '2.3.1262' );
|
define ( 'FRIENDICA_VERSION', '2.3.1262' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1124 );
|
define ( 'DB_UPDATE_VERSION', 1125 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
|
|
@ -257,6 +257,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
KEY `last-child` (`last-child`),
|
KEY `last-child` (`last-child`),
|
||||||
KEY `unseen` (`unseen`),
|
KEY `unseen` (`unseen`),
|
||||||
KEY `wall` (`wall`),
|
KEY `wall` (`wall`),
|
||||||
|
KEY `author-name` (`author-name`),
|
||||||
KEY `author-link` (`author-link`),
|
KEY `author-link` (`author-link`),
|
||||||
FULLTEXT KEY `title` (`title`),
|
FULLTEXT KEY `title` (`title`),
|
||||||
FULLTEXT KEY `body` (`body`),
|
FULLTEXT KEY `body` (`body`),
|
||||||
|
|
|
@ -1308,12 +1308,28 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
|
if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
|
||||||
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$r = q("select * from contact where uid = %d and id = %d limit 1",
|
||||||
|
intval($contact['uid']),
|
||||||
|
intval($contact['id'])
|
||||||
|
);
|
||||||
|
|
||||||
|
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||||
dbesc(notags(trim($new_name))),
|
dbesc(notags(trim($new_name))),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact['uid']),
|
intval($contact['uid']),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// do our best to update the name on content items
|
||||||
|
|
||||||
|
if(count($r)) {
|
||||||
|
q("update item set `author-name` = '%s' where `author-name` = '%s' and `author-link` = '%s' and uid = %d",
|
||||||
|
dbesc(notags(trim($new_name))),
|
||||||
|
dbesc($r[0]['name']),
|
||||||
|
dbesc($r[0]['url']),
|
||||||
|
intval($contact['uid'])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen($birthday)) {
|
if(strlen($birthday)) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1124 );
|
define( 'UPDATE_VERSION' , 1125 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -1073,3 +1073,7 @@ ADD INDEX ( `hash` ) ");
|
||||||
function update_1123() {
|
function update_1123() {
|
||||||
set_config('system','allowed_themes','dispy,quattro,testbubble,vier,darkbubble,darkzero,duepuntozero,greenzero,purplezero,quattro-green,slackr');
|
set_config('system','allowed_themes','dispy,quattro,testbubble,vier,darkbubble,darkzero,duepuntozero,greenzero,purplezero,quattro-green,slackr');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1124() {
|
||||||
|
q("alter table item add index (`author-name`) ");
|
||||||
|
}
|
Loading…
Reference in a new issue