require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/features.php');
+require_once('update.php');
+require_once('include/dbstructure.php');
+
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.2.1753' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
if(! function_exists('update_db')) {
function update_db(&$a) {
-
$build = get_config('system','build');
if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION);
if($build != DB_UPDATE_VERSION) {
$stored = intval($build);
$current = intval(DB_UPDATE_VERSION);
- if(($stored < $current) && file_exists('update.php')) {
-
+ if($stored < $current) {
load_config('database');
// We're reporting a different version than what is currently installed.
// Run any existing update scripts to bring the database up to current.
- require_once('update.php');
-
// make sure that boot.php and update.php are the same release, we might be
// updating right this very second and the correct version of the update.php
// file may not be here yet. This can happen on a very busy site.
if(DB_UPDATE_VERSION == UPDATE_VERSION) {
-
// Compare the current structure with the defined structure
$t = get_config('database','dbupdate_'.DB_UPDATE_VERSION);
set_config('database','dbupdate_'.DB_UPDATE_VERSION, time());
- require_once("include/dbstructure.php");
+ // run old update routine (wich could modify the schema and
+ // conflits with new routine)
+ for ($x = $stored; $x < NEW_UPDATE_ROUTINE_VERSION; $x++) {
+ $r = run_update_function($x);
+ if (!$r) break;
+ }
+ if ($stored < NEW_UPDATE_ROUTINE_VERSION) $stored = NEW_UPDATE_ROUTINE_VERSION;
+
+
+ // run new update routine
+ // it update the structure in one call
$retval = update_structure(false, true);
if($retval) {
update_fail(
DB_UPDATE_VERSION,
- sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
+ $retval
);
- break;
+ return;
} else {
set_config('database','dbupdate_'.DB_UPDATE_VERSION, 'success');
}
+ // run any left update_nnnn functions in update.php
for($x = $stored; $x < $current; $x ++) {
- if(function_exists('update_' . $x)) {
-
- // There could be a lot of processes running or about to run.
- // We want exactly one process to run the update command.
- // So store the fact that we're taking responsibility
- // after first checking to see if somebody else already has.
-
- // If the update fails or times-out completely you may need to
- // delete the config entry to try again.
-
- $t = get_config('database','update_' . $x);
- if($t !== false)
- break;
- set_config('database','update_' . $x, time());
-
- // call the specific update
-
- $func = 'update_' . $x;
- $retval = $func();
- if($retval) {
- //send the administrator an e-mail
- update_fail(
- $x,
- sprintf(t('Update %s failed. See error logs.'), $x)
- );
- break;
- } else {
- set_config('database','update_' . $x, 'success');
- set_config('system','build', $x + 1);
- }
- } else {
- set_config('database','update_' . $x, 'success');
- set_config('system','build', $x + 1);
- }
+ $r = run_update_function($x);
+ if (!$r) break;
}
}
}
return;
}
}
+if(!function_exists('run_update_function')){
+ function run_update_function($x) {
+ if(function_exists('update_' . $x)) {
+
+ // There could be a lot of processes running or about to run.
+ // We want exactly one process to run the update command.
+ // So store the fact that we're taking responsibility
+ // after first checking to see if somebody else already has.
+
+ // If the update fails or times-out completely you may need to
+ // delete the config entry to try again.
+
+ $t = get_config('database','update_' . $x);
+ if($t !== false)
+ return false;
+ set_config('database','update_' . $x, time());
+
+ // call the specific update
+
+ $func = 'update_' . $x;
+ $retval = $func();
+
+ if($retval) {
+ //send the administrator an e-mail
+ update_fail(
+ $x,
+ sprintf(t('Update %s failed. See error logs.'), $x)
+ );
+ return false;
+ } else {
+ set_config('database','update_' . $x, 'success');
+ set_config('system','build', $x + 1);
+ return true;
+ }
+ } else {
+ set_config('database','update_' . $x, 'success');
+ set_config('system','build', $x + 1);
+ return true;
+ }
+ return true;
+ }
+}
if(! function_exists('check_plugins')) {
<?php
# if PDO is avaible for mysql, use the new database abstraction
+# TODO: PDO is disabled for release 3.3. We need to investigate why
+# the update from 3.2 fails with pdo
+/*
if(class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
require_once("library/dddbl2/dddbl.php");
require_once("include/dba_pdo.php");
}
+*/
+
require_once('include/datetime.php');
*
* For debugging, insert 'dbg(1);' anywhere in the program flow.
* dbg(0); will turn it off. Logging is performed at LOGGER_DATA level.
- * When logging, all binary info is converted to text and html entities are escaped so that
+ * When logging, all binary info is converted to text and html entities are escaped so that
* the debugging stream is safe to view within both terminals and web pages.
*
*/
-
-if(! class_exists('dba')) {
+
+if(! class_exists('dba')) {
class dba {
private $debug = 0;
}
function __destruct() {
- if ($this->db)
+ if ($this->db)
if($this->mysqli)
$this->db->close();
else
}}
// Procedural functions
-if(! function_exists('dbg')) {
+if(! function_exists('dbg')) {
function dbg($state) {
global $db;
if($db)
$db->dbg($state);
}}
-if(! function_exists('dbesc')) {
+if(! function_exists('dbesc')) {
function dbesc($str) {
global $db;
if($db && $db->connected)
// Example: $r = q("SELECT * FROM `%s` WHERE `uid` = %d",
// 'user', 1);
-if(! function_exists('q')) {
+if(! function_exists('q')) {
function q($sql) {
global $db;
/**
*
- * This will happen occasionally trying to store the
- * session data after abnormal program termination
+ * This will happen occasionally trying to store the
+ * session data after abnormal program termination
*
*/
logger('dba: no database: ' . print_r($args,true));
- return false;
+ return false;
}}
*
*/
-if(! function_exists('dbq')) {
+if(! function_exists('dbq')) {
function dbq($sql) {
global $db;
}}
-// Caller is responsible for ensuring that any integer arguments to
+// Caller is responsible for ensuring that any integer arguments to
// dbesc_array are actually integers and not malformed strings containing
-// SQL injection vectors. All integer array elements should be specifically
-// cast to int to avoid trouble.
+// SQL injection vectors. All integer array elements should be specifically
+// cast to int to avoid trouble.
if(! function_exists('dbesc_array_cb')) {
<?php
require_once("boot.php");
require_once("include/text.php");
+
+define('NEW_UPDATE_ROUTINE_VERSION', 1170);
+
/*
* send the email and do what is needed to do on update fails
*
The friendica developers released update %s recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
- friendica developer if you can not help me on your own. My database might be invalid.");
+ friendica developer if you can not help me on your own. My database might be invalid."));
$body = t("The error message is\n[pre]%s[/pre]");
$preamble = sprintf($preamble, $update_id);
$body = sprintf($body, $error_message);
break;
}
-function dbstructure_run(&$argv, &$argc) {
- global $a, $db;
-
- if(is_null($a)){
- $a = new App;
- }
-
- if(is_null($db)) {
- @include(".htconfig.php");
- require_once("include/dba.php");
- $db = new dba($db_host, $db_user, $db_pass, $db_data);
- unset($db_host, $db_user, $db_pass, $db_data);
- }
-
- update_structure(true, true);
-}
-
-if (array_search(__file__,get_included_files())===0){
- dbstructure_run($argv,$argc);
- killme();
-}
function table_structure($table) {
$structures = q("DESCRIBE `%s`", $table);
return($database);
}
+
+
+/*
+ * run from command line
+ */
+function dbstructure_run(&$argv, &$argc) {
+ global $a, $db;
+
+ if(is_null($a)){
+ $a = new App;
+ }
+
+ if(is_null($db)) {
+ @include(".htconfig.php");
+ require_once("include/dba.php");
+ $db = new dba($db_host, $db_user, $db_pass, $db_data);
+ unset($db_host, $db_user, $db_pass, $db_data);
+ }
+
+ update_structure(true, true);
+}
+
+if (array_search(__file__,get_included_files())===0){
+ dbstructure_run($argv,$argc);
+ killme();
+}
// curl wrapper. If binary flag is true, return binary
-// results.
+// results.
// Set the cookiejar argument to a string (e.g. "/tmp/friendica-cookies.txt")
// to preserve cookies from one request to the next.
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
}
-// These settings aren't needed. We're following the location already.
+// These settings aren't needed. We're following the location already.
// @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// @curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
}}
// Generic XML return
-// Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable
-// of $st and an optional text <message> of $message and terminates the current process.
+// Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable
+// of $st and an optional text <message> of $message and terminates the current process.
if(! function_exists('xml_status')) {
function xml_status($st, $message = '') {
if($val >= 200 && $val < 300)
$err = 'OK';
- logger('http_status_exit ' . $val);
+ logger('http_status_exit ' . $val);
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err);
killme();
}
}}
-// Given an email style address, perform webfinger lookup and
+// Given an email style address, perform webfinger lookup and
// return the resulting DFRN profile URL, or if no DFRN profile URL
-// is located, returns an OStatus subscription template (prefixed
+// is located, returns an OStatus subscription template (prefixed
// with the string 'stat:' to identify it as on OStatus template).
// If this isn't an email style address just return $s.
// Return an empty string if email-style addresses but webfinger fails,
-// or if the resultant personal XRD doesn't contain a supported
+// or if the resultant personal XRD doesn't contain a supported
// subscription/friend-request attribute.
-// amended 7/9/2011 to return an hcard which could save potentially loading
+// amended 7/9/2011 to return an hcard which could save potentially loading
// a lengthy content page to scrape dfrn attributes
if(! function_exists('webfinger_dfrn')) {
return $profile_link;
}}
-// Given an email style address, perform webfinger lookup and
+// Given an email style address, perform webfinger lookup and
// return the array of link attributes from the personal XRD file.
// On error/failure return an empty array.
// All we have is an email address. Resource-priority is irrelevant
// because our URI isn't directly resolvable.
- if(strstr($uri,'@')) {
+ if(strstr($uri,'@')) {
return(webfinger($uri));
}
foreach($properties as $prop)
if((string) $prop['@attributes'] === 'http://lrdd.net/priority/resource')
$priority = 'resource';
- }
+ }
// save the links in case we need them
$tpl = '';
if($priority === 'host') {
- if(strlen($tpl))
+ if(strlen($tpl))
$pxrd = str_replace('{uri}', urlencode($uri), $tpl);
elseif(isset($href))
$pxrd = $href;
if(! function_exists('validate_url')) {
function validate_url(&$url) {
+
+ if(get_config('system','disable_url_validation'))
+ return true;
// no naked subdomains (allow localhost for tests)
if(strpos($url,'.') === false && strpos($url,'/localhost/') === false)
return false;
foreach($allowed as $a) {
$pat = strtolower(trim($a));
if(($fnmatch && fnmatch($pat,$host)) || ($pat == $host)) {
- $found = true;
+ $found = true;
break;
}
}
foreach($allowed as $a) {
$pat = strtolower(trim($a));
if(($fnmatch && fnmatch($pat,$domain)) || ($pat == $domain)) {
- $found = true;
+ $found = true;
break;
}
}
$new_height = $ph->getHeight();
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
$s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
- . "\n" . (($include_link)
+ . "\n" . (($include_link)
? '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n"
: ''),$s);
logger('scale_external_images: new string: ' . $s, LOGGER_DEBUG);
}
if($ssl_changed) {
- q("update contact set
- url = '%s',
+ q("update contact set
+ url = '%s',
request = '%s',
notify = '%s',
poll = '%s',
return array();
}
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
+ xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
// http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
q("ALTER TABLE `intro` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `knowyou` ");
q("ALTER TABLE `contact` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rel` ");
- q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
+ q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar-date`");
}
function update_1001() {
q("ALTER TABLE `item` ADD `wall` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `type` ");
- q("ALTER TABLE `item` ADD INDEX ( `wall` )");
+ q("ALTER TABLE `item` ADD INDEX ( `wall` )");
}
function update_1002() {
q("ALTER TABLE `contact` DROP `issued-pubkey` , DROP `ret-id` , DROP `ret-pubkey` ");
q("ALTER TABLE `contact` ADD `usehub` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `ret-aes`");
q("ALTER TABLE `contact` ADD `hub-verify` CHAR( 255 ) NOT NULL AFTER `usehub`");
- q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
+ q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
q("ALTER TABLE `contact` ADD INDEX ( `blocked` ), ADD INDEX ( `readonly` )");
}
function update_1007() {
q("ALTER TABLE `user` ADD `page-flags` INT NOT NULL DEFAULT '0' AFTER `notify-flags`");
- q("ALTER TABLE `user` ADD INDEX ( `nickname` )");
+ q("ALTER TABLE `user` ADD INDEX ( `nickname` )");
}
function update_1008() {
}
function update_1013() {
- q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL
+ q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL
AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`");
-}
+}
function update_1014() {
require_once('include/Photo.php');
}
$r = q("SELECT * FROM `contact` WHERE 1");
if(count($r)) {
- foreach($r as $rr) {
+ foreach($r as $rr) {
if(stristr($rr['thumb'],'avatar'))
q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('avatar','micro',$rr['thumb'])),
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` CHAR( 255 ) NOT NULL ,
`version` CHAR( 255 ) NOT NULL ,
- `installed` TINYINT( 1 ) NOT NULL DEFAULT '0'
+ `installed` TINYINT( 1 ) NOT NULL DEFAULT '0'
) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
}
}
}
}
-
+
function update_1032() {
q("ALTER TABLE `profile` ADD `pdesc` CHAR( 255 ) NOT NULL AFTER `name` ");
}
function update_1034() {
- // If you have any of these parent-less posts they can cause problems, and
+ // If you have any of these parent-less posts they can cause problems, and
// we need to delete them. You can't see them anyway.
- // Legitimate items will usually get re-created on the next
+ // Legitimate items will usually get re-created on the next
// pull from the hub.
- // But don't get rid of a post that may have just come in
+ // But don't get rid of a post that may have just come in
// and may not yet have the parent id set.
q("DELETE FROM `item` WHERE `parent` = 0 AND `created` < UTC_TIMESTAMP() - INTERVAL 2 MINUTE");
`url` CHAR( 255 ) NOT NULL ,
`photo` CHAR( 255 ) NOT NULL ,
`note` TEXT NOT NULL ,
- `created` DATETIME NOT NULL
+ `created` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8");
}
}
// There was a typo in 1076 so we'll try again in 1077 to make sure
-// We'll also make it big enough to allow for future growth, I seriously
+// We'll also make it big enough to allow for future growth, I seriously
// doubt Diaspora will be able to leave guids at 16 bytes,
// and we can also use the same structure for our own larger guids
q("CREATE TABLE IF NOT EXISTS `guid` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`guid` CHAR( 16 ) NOT NULL , INDEX ( `guid` ) ) ENGINE = MYISAM ");
- q("ALTER TABLE `guid` CHANGE `guid` `guid` CHAR( 64 ) NOT NULL");
+ q("ALTER TABLE `guid` CHANGE `guid` `guid` CHAR( 64 ) NOT NULL");
}
function update_1078() {
ADD `network` CHAR( 32 ) NOT NULL ,
ADD `alias` CHAR( 255 ) NOT NULL ,
ADD `pubkey` TEXT NOT NULL ,
- ADD INDEX ( `addr` ) ,
+ ADD INDEX ( `addr` ) ,
ADD INDEX ( `network` ) ");
}
}
function update_1097() {
- q("ALTER TABLE `queue`
- ADD INDEX (`cid`),
- ADD INDEX (`created`),
- ADD INDEX (`last`),
- ADD INDEX (`network`),
- ADD INDEX (`batch`)
+ q("ALTER TABLE `queue`
+ ADD INDEX (`cid`),
+ ADD INDEX (`created`),
+ ADD INDEX (`last`),
+ ADD INDEX (`network`),
+ ADD INDEX (`batch`)
");
}
function update_1098() {
- q("ALTER TABLE `contact`
- ADD INDEX (`network`),
- ADD INDEX (`name`),
- ADD INDEX (`nick`),
- ADD INDEX (`attag`),
+ q("ALTER TABLE `contact`
+ ADD INDEX (`network`),
+ ADD INDEX (`name`),
+ ADD INDEX (`nick`),
+ ADD INDEX (`attag`),
ADD INDEX (`url`),
- ADD INDEX (`addr`),
- ADD INDEX (`batch`)
+ ADD INDEX (`addr`),
+ ADD INDEX (`batch`)
");
}
q("ALTER TABLE `gcontact` ADD INDEX (`nurl`) ");
q("ALTER TABLE `glink` ADD INDEX (`cid`), ADD INDEX (`uid`), ADD INDEX (`gcid`), ADD INDEX (`updated`) ");
- q("ALTER TABLE `contact` ADD `poco` TEXT NOT NULL AFTER `confirm` ");
+ q("ALTER TABLE `contact` ADD `poco` TEXT NOT NULL AFTER `confirm` ");
}
q("update contact set nurl = '%s' where id = %d",
dbesc(normalise_link($rr['url'])),
intval($rr['id'])
- );
+ );
}
}
}
}
function update_1102() {
- q("ALTER TABLE `clients` ADD `name` TEXT NULL DEFAULT NULL AFTER `redirect_uri` ");
- q("ALTER TABLE `clients` ADD `icon` TEXT NULL DEFAULT NULL AFTER `name` ");
- q("ALTER TABLE `clients` ADD `uid` INT NOT NULL DEFAULT 0 AFTER `icon` ");
+ q("ALTER TABLE `clients` ADD `name` TEXT NULL DEFAULT NULL AFTER `redirect_uri` ");
+ q("ALTER TABLE `clients` ADD `icon` TEXT NULL DEFAULT NULL AFTER `name` ");
+ q("ALTER TABLE `clients` ADD `uid` INT NOT NULL DEFAULT 0 AFTER `icon` ");
- q("ALTER TABLE `tokens` ADD `secret` TEXT NOT NULL AFTER `id` ");
- q("ALTER TABLE `tokens` ADD `uid` INT NOT NULL AFTER `scope` ");
+ q("ALTER TABLE `tokens` ADD `secret` TEXT NOT NULL AFTER `id` ");
+ q("ALTER TABLE `tokens` ADD `uid` INT NOT NULL AFTER `scope` ");
}
function update_1103() {
// q("ALTER TABLE `item` ADD INDEX ( `wall` ) ");
- q("ALTER TABLE `item` ADD FULLTEXT ( `tag` ) ");
+ q("ALTER TABLE `item` ADD FULLTEXT ( `tag` ) ");
q("ALTER TABLE `contact` ADD INDEX ( `pending` ) ");
q("ALTER TABLE `user` ADD INDEX ( `hidewall` ) ");
q("ALTER TABLE `user` ADD INDEX ( `blockwall` ) ");
}
-function update_1108() {
+function update_1108() {
q("ALTER TABLE `contact` ADD `hidden` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `writable` ,
ADD INDEX ( `hidden` ) ");
}
function update_1115() {
- q("ALTER TABLE `item` ADD `moderated`
- TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `pubmail`,
+ q("ALTER TABLE `item` ADD `moderated`
+ TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `pubmail`,
ADD INDEX (`moderated`) ");
}
}
function update_1135() {
- //there can't be indexes with more than 1000 bytes in mysql,
+ //there can't be indexes with more than 1000 bytes in mysql,
//so change charset to be smaller
q("ALTER TABLE `config` CHANGE `cat` `cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL ,
-CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
-
+CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
+
//same thing for pconfig
q("ALTER TABLE `pconfig` CHANGE `cat` `cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL ,
- CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
+ CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
// faulty update merged forward. Bad update in 1134 caused duplicate k,cat pairs
- // these have to be cleared before the unique keys can be added.
+ // these have to be cleared before the unique keys can be added.
}
function update_1136() {
}
}
}
-
+
$arr = array();
$r = q("select * from pconfig where 1 order by id desc");
if(count($r)) {
}
}
}
- q("ALTER TABLE `config` ADD UNIQUE `access` ( `cat` , `k` ) ");
- q("ALTER TABLE `pconfig` ADD UNIQUE `access` ( `uid` , `cat` , `k` )");
+ q("ALTER TABLE `config` ADD UNIQUE `access` ( `cat` , `k` ) ");
+ q("ALTER TABLE `pconfig` ADD UNIQUE `access` ( `uid` , `cat` , `k` )");
}
function update_1147() {
$r1 = q("ALTER TABLE `sign` ALTER `iid` SET DEFAULT '0'");
$r2 = q("ALTER TABLE `sign` ADD `retract_iid` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `iid`");
- $r3 = q("ALTER TABLE `sign` ADD INDEX ( `retract_iid` )");
+ $r3 = q("ALTER TABLE `sign` ADD INDEX ( `retract_iid` )");
if((! $r1) || (! $r2) || (! $r3))
return UPDATE_FAILED ;
return UPDATE_SUCCESS ;
`otype` TINYINT( 3 ) UNSIGNED NOT NULL ,
`type` TINYINT( 3 ) UNSIGNED NOT NULL ,
`term` CHAR( 255 ) NOT NULL ,
- `url` CHAR( 255 ) NOT NULL,
+ `url` CHAR( 255 ) NOT NULL,
KEY `oid` ( `oid` ),
KEY `otype` ( `otype` ),
KEY `type` ( `type` ),
function update_1153() {
$r = q("ALTER TABLE `hook` ADD `priority` INT(11) UNSIGNED NOT NULL DEFAULT '0'");
-
+
if(!$r) return UPDATE_FAILED;
return UPDATE_SUCCESS;
}
function update_1163() {
set_config('system', 'maintenance', 1);
- $r = q("ALTER TABLE `item` ADD `network` char(32) NOT NULL,
- ADD INDEX (`network`)");
+ $r = q("ALTER TABLE `item` ADD `network` char(32) NOT NULL");
set_config('system', 'maintenance', 0);
-
if(!$r)
return UPDATE_FAILED;