X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=5cf9bbc2d4e437719680e454092ab31f1bca6f26;hb=057984c69e18890c6ad898bf21ea0f8e3db49614;hp=b0046f17a7f4ce4601d60c8e22d06e5f5d161594;hpb=c22920edba4f80fee2d828a9fe265a9cb702e81c;p=friendica.git diff --git a/update.php b/update.php index b0046f17a7..5cf9bbc2d4 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,11 @@ false )); $sprvkey = ''; @@ -122,7 +127,7 @@ function update_1010() { function update_1011() { q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` "); $r = q("SELECT * FROM `contact` WHERE 1"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d", dbesc(basename($rr['url'])), @@ -145,7 +150,7 @@ function update_1014() { require_once('include/Photo.php'); q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` "); $r = q("SELECT * FROM `photo` WHERE `scale` = 4"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $ph = new Photo($rr['data']); if ($ph->is_valid()) { @@ -155,7 +160,7 @@ function update_1014() { } } $r = q("SELECT * FROM `contact` WHERE 1"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { if(stristr($rr['thumb'],'avatar')) q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d", @@ -308,7 +313,7 @@ function update_1030() { function update_1031() { // Repair any bad links that slipped into the item table $r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' "); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { if (strstr($rr['object'],'type="http')) { q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d", @@ -357,7 +362,7 @@ function update_1035() { function update_1036() { $r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' AND `photo` LIKE '%include/photo%' "); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d", dbesc(str_replace('include/photo','photo',$rr['photo'])), @@ -595,7 +600,7 @@ function update_1073() { function update_1074() { q("ALTER TABLE `user` ADD `hidewall` TINYINT( 1) NOT NULL DEFAULT '0' AFTER `blockwall` "); $r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach($r as $rr) q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d", intval($rr['uid']) @@ -607,7 +612,7 @@ function update_1074() { function update_1075() { q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` "); $r = q("SELECT `uid` FROM `user` WHERE 1"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $found = true; do { @@ -686,10 +691,10 @@ function update_1082() { ADD INDEX ( `guid` ) "); // make certain the following code is only executed once $r = q("select `id` from `photo` where `guid` != '' limit 1"); - if (dbm::is_result($r)) + if (DBM::is_result($r)) return; $r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $guid = get_guid(); q("update `photo` set `guid` = '%s' where `resource-id` = '%s'", @@ -732,7 +737,7 @@ function update_1087() { q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` "); $r = q("SELECT `id` FROM `item` WHERE `parent` = `id` "); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1", intval($rr['id']) @@ -855,7 +860,7 @@ function update_1100() { require_once('include/text.php'); $r = q("select id, url from contact where url != '' and nurl = '' "); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { q("update contact set nurl = '%s' where id = %d", dbesc(normalise_link($rr['url'])), @@ -1031,7 +1036,7 @@ function update_1120() { // might be missing on new installs. We'll check. $r = q("describe item"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach($r as $rr) if($rr['Field'] == 'spam') return; @@ -1073,7 +1078,7 @@ ADD INDEX ( `hash` ) "); } function update_1123() { -set_config('system','allowed_themes','dispy,quattro,testbubble,vier,darkbubble,darkzero,duepuntozero,greenzero,purplezero,quattro-green,slackr'); +Config::set('system','allowed_themes','dispy,quattro,testbubble,vier,darkbubble,darkzero,duepuntozero,greenzero,purplezero,quattro-green,slackr'); } function update_1124() { @@ -1169,7 +1174,7 @@ function update_1136() { // order in reverse so that we save the newest entry $r = q("select * from config where 1 order by id desc"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $found = false; foreach($arr as $x) { @@ -1188,7 +1193,7 @@ function update_1136() { $arr = array(); $r = q("select * from pconfig where 1 order by id desc"); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $found = false; foreach($arr as $x) { @@ -1387,14 +1392,14 @@ function update_1157() { } function update_1158() { - set_config('system', 'maintenance', 1); + Config::set('system', 'maintenance', 1); // Wait for 15 seconds for current requests to // clear before locking up the database sleep(15); $r = q("CREATE INDEX event_id ON item(`event-id`)"); - set_config('system', 'maintenance', 0); + Config::set('system', 'maintenance', 0); if($r) return UPDATE_SUCCESS; @@ -1415,14 +1420,14 @@ function update_1159() { } function update_1160() { - set_config('system', 'maintenance', 1); + Config::set('system', 'maintenance', 1); // Wait for 15 seconds for current requests to // clear before locking up the database sleep(15); $r = q("ALTER TABLE `item` ADD `mention` TINYINT(1) NOT NULL DEFAULT '0', ADD INDEX (`mention`)"); - set_config('system', 'maintenance', 0); + Config::set('system', 'maintenance', 0); if(!$r) return UPDATE_FAILED; @@ -1447,18 +1452,18 @@ function update_1162() { } function update_1163() { - set_config('system', 'maintenance', 1); + Config::set('system', 'maintenance', 1); $r = q("ALTER TABLE `item` ADD `network` char(32) NOT NULL"); - set_config('system', 'maintenance', 0); + Config::set('system', 'maintenance', 0); if(!$r) return UPDATE_FAILED; return UPDATE_SUCCESS; } function update_1164() { - set_config('system', 'maintenance', 1); + Config::set('system', 'maintenance', 1); $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '' AND `contact`.`uid` = `item`.`uid`)", NETWORK_DFRN); @@ -1505,7 +1510,7 @@ function update_1164() { $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", NETWORK_TWITTER, NETWORK_TWITTER); - set_config('system', 'maintenance', 0); + Config::set('system', 'maintenance', 0); return UPDATE_SUCCESS; } @@ -1596,7 +1601,7 @@ function update_1169() { if (!$r) return UPDATE_FAILED; - proc_run(PRIORITY_LOW, "include/threadupdate.php"); + Worker::add(PRIORITY_LOW, "ThreadUpdate"); return UPDATE_SUCCESS; } @@ -1633,11 +1638,11 @@ function update_1177() { } function update_1178() { - if (get_config('system','no_community_page')) - set_config('system','community_page_style', CP_NO_COMMUNITY_PAGE); + if (Config::get('system','no_community_page')) + Config::set('system','community_page_style', CP_NO_COMMUNITY_PAGE); // Update the central item storage with uid=0 - proc_run(PRIORITY_LOW, "include/threadupdate.php"); + Worker::add(PRIORITY_LOW, "threadupdate"); return UPDATE_SUCCESS; } @@ -1645,17 +1650,17 @@ function update_1178() { function update_1180() { // Fill the new fields in the term table. - proc_run(PRIORITY_LOW, "include/tagupdate.php"); + Worker::add(PRIORITY_LOW, "TagUpdate"); return UPDATE_SUCCESS; } function update_1188() { - if (strlen(get_config('system','directory_submit_url')) && - !strlen(get_config('system','directory'))) { - set_config('system','directory', dirname(get_config('system','directory_submit_url'))); - del_config('system','directory_submit_url'); + if (strlen(Config::get('system','directory_submit_url')) && + !strlen(Config::get('system','directory'))) { + Config::set('system','directory', dirname(Config::get('system','directory_submit_url'))); + Config::delete('system','directory_submit_url'); } return UPDATE_SUCCESS; @@ -1665,11 +1670,11 @@ function update_1190() { require_once('include/plugin.php'); - set_config('system', 'maintenance', 1); + Config::set('system', 'maintenance', 1); if (plugin_enabled('forumlist')) { $plugin = 'forumlist'; - $plugins = get_config('system','addon'); + $plugins = Config::get('system','addon'); $plugins_arr = array(); if ($plugins) { @@ -1682,7 +1687,7 @@ function update_1190() { // since uninstall_plugin() don't work here q("DELETE FROM `addon` WHERE `name` = 'forumlist' "); q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' "); - set_config('system','addon', implode(", ",$plugins_arr)); + Config::set('system','addon', implode(", ",$plugins_arr)); } } } @@ -1693,7 +1698,7 @@ function update_1190() { ); // convert old forumlist addon entries in new config entries - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $uid = $rr['uid']; $family = $rr['cat']; @@ -1701,25 +1706,25 @@ function update_1190() { $value = $rr['v']; if ($key === 'randomise') - del_pconfig($uid,$family,$key); + PConfig::delete($uid,$family,$key); if ($key === 'show_on_profile') { if ($value) - set_pconfig($uid,feature,forumlist_profile,$value); + PConfig::set($uid,feature,forumlist_profile,$value); - del_pconfig($uid,$family,$key); + PConfig::delete($uid,$family,$key); } if ($key === 'show_on_network') { if ($value) - set_pconfig($uid,feature,forumlist_widget,$value); + PConfig::set($uid,feature,forumlist_widget,$value); - del_pconfig($uid,$family,$key); + PConfig::delete($uid,$family,$key); } } } - set_config('system', 'maintenance', 0); + Config::set('system', 'maintenance', 0); return UPDATE_SUCCESS;