X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=751e15b587bf7dbbe06012210f00eca3530cc017;hb=6287e466507f88be22d77796660f806089b62af2;hp=b0046f17a7f4ce4601d60c8e22d06e5f5d161594;hpb=541d6ab8959fe3c069996e230def126c154da34d;p=friendica.git diff --git a/update.php b/update.php index b0046f17a7..751e15b587 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,13 @@ false )); $sprvkey = ''; @@ -122,7 +129,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'])), @@ -141,21 +148,21 @@ function update_1013() { AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`"); } -function update_1014() { - require_once('include/Photo.php'); +function update_1014() +{ 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()) { - $ph->scaleImage(48); - $ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0)); + $Image = new Image($rr['data']); + if ($Image->isValid()) { + $Image->scaleDown(48); + Photo::store($Image, $rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0)); } } } $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 +315,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 +364,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 +602,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,11 +614,11 @@ 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 { - $guid = substr(random_string(),0,16); + $guid = random_string(16); $x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1", dbesc($guid) ); @@ -686,10 +693,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 +739,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 +862,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 +1038,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 +1080,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 +1176,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 +1195,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 +1394,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 +1422,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 +1454,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); @@ -1466,9 +1473,6 @@ 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_DFRN, NETWORK_DFRN); - $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", - NETWORK_ZOT, NETWORK_ZOT); - $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", NETWORK_OSTATUS, NETWORK_OSTATUS); @@ -1481,9 +1485,6 @@ 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_MAIL, NETWORK_MAIL); - $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", - NETWORK_MAIL2, NETWORK_MAIL2); - $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", NETWORK_FACEBOOK, NETWORK_FACEBOOK); @@ -1505,7 +1506,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 +1597,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 +1634,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 +1646,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 +1666,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 +1683,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 +1694,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 +1702,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;