aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Extend/Hook.php8
-rw-r--r--Zotlabs/Lib/Config.php166
-rw-r--r--Zotlabs/Module/Admin.php2
-rwxr-xr-xboot.php8
-rw-r--r--include/config.php161
-rw-r--r--include/language.php4
-rw-r--r--include/network.php2
-rwxr-xr-xinclude/plugin.php22
-rw-r--r--include/widgets.php2
-rw-r--r--install/schema_mysql.sql8
-rw-r--r--install/schema_postgres.sql8
-rw-r--r--install/update.php20
12 files changed, 234 insertions, 177 deletions
diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php
index 713165faf..fc1e95367 100644
--- a/Zotlabs/Extend/Hook.php
+++ b/Zotlabs/Extend/Hook.php
@@ -10,7 +10,7 @@ class Hook {
$function = serialize($function);
}
- $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' and priority = %d and hook_version = %d LIMIT 1",
+ $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d LIMIT 1",
dbesc($hook),
dbesc($file),
dbesc($function),
@@ -23,13 +23,13 @@ class Hook {
// To aid in upgrade and transition, remove old settings for any registered hooks that match in all respects except
// for priority or hook_version
- $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'",
+ $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `fn` = '%s'",
dbesc($hook),
dbesc($file),
dbesc($function)
);
- $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )",
+ $r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )",
dbesc($hook),
dbesc($file),
dbesc($function),
@@ -44,7 +44,7 @@ class Hook {
if(is_array($function)) {
$function = serialize($function);
}
- $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `function` = '%s' and priority = %d and hook_version = %d",
+ $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d",
dbesc($hook),
dbesc($file),
dbesc($function),
diff --git a/Zotlabs/Lib/Config.php b/Zotlabs/Lib/Config.php
new file mode 100644
index 000000000..d4ee1aeda
--- /dev/null
+++ b/Zotlabs/Lib/Config.php
@@ -0,0 +1,166 @@
+<?php /** @file */
+
+namespace Zotlabs\Lib;
+
+
+class Config {
+
+ /**
+ * @brief Loads the hub's configuration from database to a cached storage.
+ *
+ * Retrieve a category ($family) of config variables from database to a cached
+ * storage in the global App::$config[$family].
+ *
+ * @param string $family
+ * The category of the configuration value
+ */
+
+ static public function Load($family) {
+ if(! array_key_exists($family, \App::$config))
+ \App::$config[$family] = array();
+
+ if(! array_key_exists('config_loaded', \App::$config[$family])) {
+ $r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family));
+ if($r !== false) {
+ if($r) {
+ foreach($r as $rr) {
+ $k = $rr['k'];
+ \App::$config[$family][$k] = $rr['v'];
+ }
+ }
+ \App::$config[$family]['config_loaded'] = true;
+ }
+ }
+ }
+
+ /**
+ * @brief Sets a configuration value for the hub.
+ *
+ * Stores a config value ($value) in the category ($family) under the key ($key).
+ *
+ * @param string $family
+ * The category of the configuration value
+ * @param string $key
+ * The configuration key to set
+ * @param mixed $value
+ * The value to store in the configuration
+ * @return mixed
+ * Return the set value, or false if the database update failed
+ */
+
+ static public function Set($family,$key,$value) {
+ // manage array value
+ $dbvalue = ((is_array($value)) ? serialize($value) : $value);
+ $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
+
+ if(get_config($family, $key) === false || (! self::get_from_storage($family, $key))) {
+ $ret = q("INSERT INTO config ( cat, k, v ) VALUES ( '%s', '%s', '%s' ) ",
+ dbesc($family),
+ dbesc($key),
+ dbesc($dbvalue)
+ );
+ if($ret) {
+ \App::$config[$family][$key] = $value;
+ $ret = $value;
+ }
+ return $ret;
+ }
+
+ $ret = q("UPDATE config SET v = '%s' WHERE cat = '%s' AND k = '%s'",
+ dbesc($dbvalue),
+ dbesc($family),
+ dbesc($key)
+ );
+
+ if($ret) {
+ \App::$config[$family][$key] = $value;
+ $ret = $value;
+ }
+ return $ret;
+
+ }
+
+ /**
+ * @brief Get a particular config variable given the category name ($family)
+ * and a key.
+ *
+ * Get a particular config variable from the given category ($family) and the
+ * $key from a cached storage in App::$config[$family]. If a key is found in the
+ * DB but does not exist in local config cache, pull it into the cache so we
+ * do not have to hit the DB again for this item.
+ *
+ * Returns false if not set.
+ *
+ * @param string $family
+ * The category of the configuration value
+ * @param string $key
+ * The configuration key to query
+ * @return mixed Return value or false on error or if not set
+ */
+
+ static public function Get($family,$key) {
+ if((! array_key_exists($family, \App::$config)) || (! array_key_exists('config_loaded', \App::$config[$family])))
+ self::Load($family);
+
+ if(array_key_exists('config_loaded', \App::$config[$family])) {
+ if(! array_key_exists($key, \App::$config[$family])) {
+ return false;
+ }
+ return ((! is_array(\App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$family][$key]))
+ ? unserialize(\App::$config[$family][$key])
+ : \App::$config[$family][$key]
+ );
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Deletes the given key from the hub's configuration database.
+ *
+ * Removes the configured value from the stored cache in App::$config[$family]
+ * and removes it from the database.
+ *
+ * @param string $family
+ * The category of the configuration value
+ * @param string $key
+ * The configuration key to delete
+ * @return mixed
+ */
+
+ static public function Delete($family,$key) {
+
+ $ret = false;
+
+ if(array_key_exists($family, \App::$config) && array_key_exists($key, \App::$config[$family]))
+ unset(\App::$config[$family][$key]);
+ $ret = q("DELETE FROM config WHERE cat = '%s' AND k = '%s'",
+ dbesc($family),
+ dbesc($key)
+ );
+ return $ret;
+ }
+
+
+ /**
+ * @brief Returns a value directly from the database configuration storage.
+ *
+ * This function queries directly the database and bypasses the chached storage
+ * from get_config($family, $key).
+ *
+ * @param string $family
+ * The category of the configuration value
+ * @param string $key
+ * The configuration key to query
+ * @return mixed
+ */
+
+ static private function get_from_storage($family,$key) {
+ $ret = q("SELECT * FROM config WHERE cat = '%s' AND k = '%s' LIMIT 1",
+ dbesc($family),
+ dbesc($key)
+ );
+ return $ret;
+ }
+
+}
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 8f15035d1..4cabd78ca 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -1291,7 +1291,7 @@ class Admin extends \Zotlabs\Web\Controller {
$admin_form = '';
- $r = q("select * from addon where plugin_admin = 1 and name = '%s' limit 1",
+ $r = q("select * from addon where plugin_admin = 1 and aname = '%s' limit 1",
dbesc($plugin)
);
diff --git a/boot.php b/boot.php
index a882be2eb..f1aa0cf9d 100755
--- a/boot.php
+++ b/boot.php
@@ -48,7 +48,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '1.7.1' );
define ( 'ZOT_REVISION', 1.1 );
-define ( 'DB_UPDATE_VERSION', 1169 );
+define ( 'DB_UPDATE_VERSION', 1170 );
/**
@@ -1522,11 +1522,11 @@ function check_config(&$a) {
if(count($installed)) {
foreach($installed as $i) {
- if(! in_array($i['name'], $plugins_arr)) {
- unload_plugin($i['name']);
+ if(! in_array($i['aname'], $plugins_arr)) {
+ unload_plugin($i['aname']);
}
else {
- $installed_arr[] = $i['name'];
+ $installed_arr[] = $i['aname'];
}
}
}
diff --git a/include/config.php b/include/config.php
index 3017c3865..fe7cbead6 100644
--- a/include/config.php
+++ b/include/config.php
@@ -1,17 +1,13 @@
<?php
+
/**
* @file include/config.php
* @brief Arbitrary configuration storage.
*
- * @note Please do not store booleans - convert to 0/1 integer values.
- * The get_?config() functions return boolean false for keys that are unset,
- * and this could lead to subtle bugs.
- *
- * Arrays get stored as serialize strings.
- *
- * @todo There are a few places in the code (such as the admin panel) where
- * boolean configurations need to be fixed as of 10/08/2011.
+ * Arrays get stored as serialized strings.
+ * Booleans are stored as integer 0/1.
*
+
* - <b>config</b> is used for hub specific configurations. It overrides the
* configurations from .htconfig file. The storage is of size TEXT.
* - <b>pconfig</b> is used for channel specific configurations and takes a
@@ -34,163 +30,39 @@
*
*/
-/**
- * @brief Loads the hub's configuration from database to a cached storage.
- *
- * Retrieve a category ($family) of config variables from database to a cached
- * storage in the global App::$config[$family].
- *
- * @param string $family
- * The category of the configuration value
- */
-function load_config($family) {
- if(! array_key_exists($family, App::$config))
- App::$config[$family] = array();
+use Zotlabs\Lib as Zlib;
- if(! array_key_exists('config_loaded', App::$config[$family])) {
- $r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family));
- if($r !== false) {
- if($r) {
- foreach($r as $rr) {
- $k = $rr['k'];
- App::$config[$family][$k] = $rr['v'];
- }
- }
- App::$config[$family]['config_loaded'] = true;
- }
- }
-}
-/**
- * @brief Get a particular config variable given the category name ($family)
- * and a key.
- *
- * Get a particular config variable from the given category ($family) and the
- * $key from a cached storage in App::$config[$family]. If a key is found in the
- * DB but does not exist in local config cache, pull it into the cache so we
- * do not have to hit the DB again for this item.
- *
- * Returns false if not set.
- *
- * @param string $family
- * The category of the configuration value
- * @param string $key
- * The configuration key to query
- * @return mixed Return value or false on error or if not set
- */
-function get_config($family, $key) {
- if((! array_key_exists($family, App::$config)) || (! array_key_exists('config_loaded', App::$config[$family])))
- load_config($family);
+function load_config($family) {
+
+ Zlib\Config::Load($family);
- if(array_key_exists('config_loaded', App::$config[$family])) {
- if(! array_key_exists($key, App::$config[$family])) {
- return false;
- }
- return ((! is_array(App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', App::$config[$family][$key]))
- ? unserialize(App::$config[$family][$key])
- : App::$config[$family][$key]
- );
- }
- return false;
}
-/**
- * @brief Returns a value directly from the database configuration storage.
- *
- * This function queries directly the database and bypasses the chached storage
- * from get_config($family, $key).
- *
- * @param string $family
- * The category of the configuration value
- * @param string $key
- * The configuration key to query
- * @return mixed
- */
+function get_config($family, $key) {
+
+ return Zlib\Config::Get($family,$key);
-function get_config_from_storage($family, $key) {
- $ret = q("SELECT * FROM config WHERE cat = '%s' AND k = '%s' LIMIT 1",
- dbesc($family),
- dbesc($key)
- );
- return $ret;
}
-/**
- * @brief Sets a configuration value for the hub.
- *
- * Stores a config value ($value) in the category ($family) under the key ($key).
- *
- * @note Please do not store booleans - convert to 0/1 integer values!
- *
- * @param string $family
- * The category of the configuration value
- * @param string $key
- * The configuration key to set
- * @param mixed $value
- * The value to store in the configuration
- * @return mixed
- * Return the set value, or false if the database update failed
- */
function set_config($family, $key, $value) {
- // manage array value
- $dbvalue = ((is_array($value)) ? serialize($value) : $value);
- $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
-
- if(get_config($family, $key) === false || (! get_config_from_storage($family, $key))) {
- $ret = q("INSERT INTO config ( cat, k, v ) VALUES ( '%s', '%s', '%s' ) ",
- dbesc($family),
- dbesc($key),
- dbesc($dbvalue)
- );
- if($ret) {
- App::$config[$family][$key] = $value;
- $ret = $value;
- }
- return $ret;
- }
+ return Zlib\Config::Set($family,$key,$value);
- $ret = q("UPDATE config SET v = '%s' WHERE cat = '%s' AND k = '%s'",
- dbesc($dbvalue),
- dbesc($family),
- dbesc($key)
- );
-
- if($ret) {
- App::$config[$family][$key] = $value;
- $ret = $value;
- }
- return $ret;
}
-/**
- * @brief Deletes the given key from the hub's configuration database.
- *
- * Removes the configured value from the stored cache in App::$config[$family]
- * and removes it from the database.
- *
- * @param string $family
- * The category of the configuration value
- * @param string $key
- * The configuration key to delete
- * @return mixed
- */
function del_config($family, $key) {
- $ret = false;
+ return Zlib\Config::Delete($family,$key);
- if(array_key_exists($family, App::$config) && array_key_exists($key, App::$config[$family]))
- unset(App::$config[$family][$key]);
- $ret = q("DELETE FROM config WHERE cat = '%s' AND k = '%s'",
- dbesc($family),
- dbesc($key)
- );
- return $ret;
}
+
+
+
/**
* @brief Loads all configuration values of a channel into a cached storage.
*
@@ -201,6 +73,7 @@ function del_config($family, $key) {
* The channel_id
* @return void|false Nothing or false if $uid is false
*/
+
function load_pconfig($uid) {
if($uid === false)
diff --git a/include/language.php b/include/language.php
index 238c23028..96d3e48a9 100644
--- a/include/language.php
+++ b/include/language.php
@@ -132,10 +132,10 @@ function load_translation_table($lang, $install = false) {
}
if(! $install) {
- $plugins = q("SELECT name FROM addon WHERE installed=1;");
+ $plugins = q("SELECT aname FROM addon WHERE installed=1;");
if ($plugins !== false) {
foreach($plugins as $p) {
- $name = $p['name'];
+ $name = $p['aname'];
if(file_exists("addon/$name/lang/$lang/hstrings.php")) {
include("addon/$name/lang/$lang/hstrings.php");
}
diff --git a/include/network.php b/include/network.php
index dd266f5d1..0dd10e29b 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1967,7 +1967,7 @@ function get_site_info() {
$r = q("select * from addon where hidden = 0");
if(count($r))
foreach($r as $rr)
- $visible_plugins[] = $rr['name'];
+ $visible_plugins[] = $rr['aname'];
}
sort($visible_plugins);
diff --git a/include/plugin.php b/include/plugin.php
index 6c108fcc5..5dbfc218a 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -41,7 +41,7 @@ function uninstall_plugin($plugin) {
$func();
}
- q("DELETE FROM `addon` WHERE `name` = '%s' ",
+ q("DELETE FROM `addon` WHERE `aname` = '%s' ",
dbesc($plugin)
);
}
@@ -66,7 +66,7 @@ function install_plugin($plugin) {
$plugin_admin = (function_exists($plugin . '_plugin_admin') ? 1 : 0);
- q("INSERT INTO `addon` (`name`, `installed`, `timestamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ",
+ q("INSERT INTO `addon` (`aname`, `installed`, `tstamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ",
dbesc($plugin),
intval($t),
$plugin_admin
@@ -111,7 +111,7 @@ function load_plugin($plugin) {
}
function plugin_is_installed($name) {
- $r = q("select name from addon where name = '%s' and installed = 1 limit 1",
+ $r = q("select aname from addon where aname = '%s' and installed = 1 limit 1",
dbesc($name)
);
if($r)
@@ -143,8 +143,8 @@ function reload_plugins() {
if(file_exists($fname)) {
$t = @filemtime($fname);
foreach($installed as $i) {
- if(($i['name'] == $pl) && ($i['timestamp'] != $t)) {
- logger('Reloading plugin: ' . $i['name']);
+ if(($i['aname'] == $pl) && ($i['tstamp'] != $t)) {
+ logger('Reloading plugin: ' . $i['aname']);
@include_once($fname);
if(function_exists($pl . '_unload')) {
@@ -155,7 +155,7 @@ function reload_plugins() {
$func = $pl . '_load';
$func();
}
- q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d",
+ q("UPDATE `addon` SET `tstamp` = %d WHERE `id` = %d",
intval($t),
intval($i['id'])
);
@@ -178,7 +178,7 @@ function reload_plugins() {
* @return mixed|bool
*/
function register_hook($hook, $file, $function, $priority = 0) {
- $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' LIMIT 1",
dbesc($hook),
dbesc($file),
dbesc($function)
@@ -186,7 +186,7 @@ function register_hook($hook, $file, $function, $priority = 0) {
if($r)
return true;
- $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' )",
+ $r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`) VALUES ( '%s', '%s', '%s', '%s' )",
dbesc($hook),
dbesc($file),
dbesc($function),
@@ -206,7 +206,7 @@ function register_hook($hook, $file, $function, $priority = 0) {
* @return array
*/
function unregister_hook($hook, $file, $function) {
- $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `function` = '%s'",
+ $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s'",
dbesc($hook),
dbesc($file),
dbesc($function)
@@ -233,7 +233,7 @@ function load_hooks() {
if(! array_key_exists($rr['hook'],App::$hooks))
App::$hooks[$rr['hook']] = array();
- App::$hooks[$rr['hook']][] = array($rr['file'],$rr['function'],$rr['priority'],$rr['hook_version']);
+ App::$hooks[$rr['hook']][] = array($rr['file'],$rr['fn'],$rr['priority'],$rr['hook_version']);
}
}
//logger('hooks: ' . print_r(App::$hooks,true));
@@ -301,7 +301,7 @@ function call_hooks($name, &$data = null) {
else
$func($a, $data);
} else {
- q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'",
+ q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'",
dbesc($name),
dbesc($hook[0]),
dbesc($origfn)
diff --git a/include/widgets.php b/include/widgets.php
index c4b80afd0..b9cb8e50d 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1397,7 +1397,7 @@ function widget_admin($arr) {
$plugins = array();
if($r) {
foreach ($r as $h){
- $plugin = $h['name'];
+ $plugin = $h['aname'];
$plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin');
// temp plugins with admin
App::$plugins_admin[] = $plugin;
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index a674ab8c4..68b739f7a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -96,15 +96,15 @@ CREATE TABLE IF NOT EXISTS `account` (
CREATE TABLE IF NOT EXISTS `addon` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` char(255) NOT NULL DEFAULT '',
+ `aname` char(255) NOT NULL DEFAULT '',
`version` char(255) NOT NULL DEFAULT '',
`installed` tinyint(1) NOT NULL DEFAULT '0',
`hidden` tinyint(1) NOT NULL DEFAULT '0',
- `timestamp` bigint(20) NOT NULL DEFAULT '0',
+ `tstamp` bigint(20) NOT NULL DEFAULT '0',
`plugin_admin` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `hidden` (`hidden`),
- KEY `name` (`name`),
+ KEY `aname` (`aname`),
KEY `installed` (`installed`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -519,7 +519,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hook` char(255) NOT NULL DEFAULT '',
`file` char(255) NOT NULL DEFAULT '',
- `function` char(255) NOT NULL DEFAULT '',
+ `fn` char(255) NOT NULL DEFAULT '',
`priority` int(11) unsigned NOT NULL DEFAULT '0',
`hook_version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index e2c078dc1..76a3a013e 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -94,16 +94,16 @@ create index "account_level" on account ("account_level");
create index "account_password_changed" on account ("account_password_changed");
CREATE TABLE "addon" (
"id" serial NOT NULL,
- "name" text NOT NULL,
+ "aname" text NOT NULL,
"version" text NOT NULL DEFAULT '0',
"installed" numeric(1) NOT NULL DEFAULT '0',
"hidden" numeric(1) NOT NULL DEFAULT '0',
- "timestamp" numeric(20) NOT NULL DEFAULT '0',
+ "tstamp" numeric(20) NOT NULL DEFAULT '0',
"plugin_admin" numeric(1) NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
);
create index "addon_hidden_idx" on addon ("hidden");
-create index "addon_name_idx" on addon ("name");
+create index "addon_name_idx" on addon ("aname");
create index "addon_installed_idx" on addon ("installed");
CREATE TABLE "app" (
"id" serial NOT NULL,
@@ -514,7 +514,7 @@ CREATE TABLE "hook" (
"id" serial NOT NULL,
"hook" text NOT NULL,
"file" text NOT NULL,
- "function" text NOT NULL,
+ "fn" text NOT NULL,
"priority" bigint NOT NULL DEFAULT '0',
"hook_version" smallint NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
diff --git a/install/update.php b/install/update.php
index 983db1bb9..686c199b5 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1169 );
+define( 'UPDATE_VERSION' , 1170 );
/**
*
@@ -2114,3 +2114,21 @@ function update_r1168() {
return UPDATE_FAILED;
}
+function update_r1169() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
+ $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' ");
+
+ }
+ else {
+ $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
+ $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' ");
+ }
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+} \ No newline at end of file