summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db_structure.xml10
-rw-r--r--lib/appconfig.php22
-rw-r--r--lib/config.php4
-rw-r--r--lib/log.php14
-rw-r--r--lib/preferences.php28
5 files changed, 40 insertions, 38 deletions
diff --git a/db_structure.xml b/db_structure.xml
index d8016995eaf..599352c2a8d 100644
--- a/db_structure.xml
+++ b/db_structure.xml
@@ -22,7 +22,7 @@
</field>
<field>
- <name>key</name>
+ <name>configkey</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
@@ -30,7 +30,7 @@
</field>
<field>
- <name>value</name>
+ <name>configvalue</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
@@ -282,7 +282,7 @@
</field>
<field>
- <name>timestamp</name>
+ <name>moment</name>
<type>timestamp</type>
<default>0000-00-00 00:00:00</default>
<notnull>true</notnull>
@@ -345,7 +345,7 @@
</field>
<field>
- <name>key</name>
+ <name>configkey</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
@@ -353,7 +353,7 @@
</field>
<field>
- <name>value</name>
+ <name>configvalue</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
diff --git a/lib/appconfig.php b/lib/appconfig.php
index f7c49ca19cc..4fef7542f40 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -27,8 +27,8 @@
*
* CREATE TABLE `appconfig` (
* `appid` VARCHAR( 255 ) NOT NULL ,
- * `key` VARCHAR( 255 ) NOT NULL ,
- * `value` VARCHAR( 255 ) NOT NULL
+ * `configkey` VARCHAR( 255 ) NOT NULL ,
+ * `configvalue` VARCHAR( 255 ) NOT NULL
* )
*
*/
@@ -47,7 +47,7 @@ class OC_APPCONFIG{
*/
public static function getApps(){
// No magic in here!
- $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM `*PREFIX*appconfig`' );
+ $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM *PREFIX*appconfig' );
$result = $query->execute();
$apps = array();
@@ -68,12 +68,12 @@ class OC_APPCONFIG{
*/
public static function getKeys( $app ){
// No magic in here as well
- $query = OC_DB::prepare( 'SELECT key FROM `*PREFIX*appconfig` WHERE `appid` = ?' );
+ $query = OC_DB::prepare( 'SELECT configkey FROM *PREFIX*appconfig WHERE appid = ?' );
$result = $query->execute( array( $app ));
$keys = array();
while( $row = $result->fetchRow()){
- $keys[] = $row["key"];
+ $keys[] = $row["configkey"];
}
return $keys;
@@ -91,7 +91,7 @@ class OC_APPCONFIG{
*/
public static function getValue( $app, $key, $default = null ){
// At least some magic in here :-)
- $query = OC_DB::prepare( 'SELECT value FROM *PREFIX*appconfig WHERE appid = ? AND key = ?' );
+ $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*appconfig WHERE appid = ? AND configkey = ?' );
$result = $query->execute( array( $app, $key ));
if( !$result->numRows()){
@@ -100,7 +100,7 @@ class OC_APPCONFIG{
$row = $result->fetchRow();
- return $row["value"];
+ return $row["configvalue"];
}
/**
@@ -118,11 +118,11 @@ class OC_APPCONFIG{
// null: does not exist
if( is_null( $exists )){
- $query = OC_DB::prepare( 'INSERT INTO *PREFIX*appconfig ( `appid`, `key`, `value` ) VALUES( ?, ?, ? )' );
+ $query = OC_DB::prepare( 'INSERT INTO *PREFIX*appconfig ( appid, configkey, configvalue ) VALUES( ?, ?, ? )' );
$query->execute( array( $app, $key, $value ));
}
else{
- $query = OC_DB::prepare( 'UPDATE *PREFIX*appconfig SET value = ? WHERE appid = ? AND key = ?' );
+ $query = OC_DB::prepare( 'UPDATE *PREFIX*appconfig SET configvalue = ? WHERE appid = ? AND configkey = ?' );
$query->execute( array( $value, $app, $key ));
}
}
@@ -137,7 +137,7 @@ class OC_APPCONFIG{
*/
public static function deleteKey( $app, $key ){
// Boring!
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `key` = ?' );
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*appconfig WHERE appid = ? AND configkey = ?' );
$query->execute( array( $app, $key ));
return true;
@@ -152,7 +152,7 @@ class OC_APPCONFIG{
*/
public static function deleteApp( $app ){
// Nothing special
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*appconfig` WHERE `appid` = ?' );
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*appconfig WHERE appid = ?' );
$query->execute( array( $app ));
return true;
diff --git a/lib/config.php b/lib/config.php
index 2660f43cad7..6af9fcbe5ad 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -139,7 +139,9 @@ class OC_CONFIG{
// Include the file, save the data from $CONFIG
include( "$SERVERROOT/config/config.php" );
- self::$cache = $CONFIG;
+ if( isset( $CONFIG ) || is_array( $CONFIG )){
+ self::$cache = $CONFIG;
+ }
// We cached everything
self::$init = true;
diff --git a/lib/log.php b/lib/log.php
index 02ad8162d51..aebeba7d4b3 100644
--- a/lib/log.php
+++ b/lib/log.php
@@ -27,7 +27,7 @@
*
* CREATE TABLE `log` (
* `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
- * `timestamp` DATETIME NOT NULL ,
+ * `moment` DATETIME NOT NULL ,
* `appid` VARCHAR( 255 ) NOT NULL ,
* `user` VARCHAR( 255 ) NOT NULL ,
* `action` VARCHAR( 255 ) NOT NULL ,
@@ -51,7 +51,7 @@ class OC_LOG {
* This function adds another entry to the log database
*/
public static function add( $appid, $subject, $predicate, $object = ' ' ){
- $query=OC_DB::prepare("INSERT INTO *PREFIX*log(`timestamp`,appid,user,action,info) VALUES(NOW(),?,?,?,?)");
+ $query=OC_DB::prepare("INSERT INTO *PREFIX*log(moment,appid,user,action,info) VALUES(NOW(),?,?,?,?)");
$result=$query->execute(array($appid,$subject,$predicate,$object));
// Die if we have an error
if( PEAR::isError($result)) {
@@ -82,11 +82,11 @@ class OC_LOG {
$queryString='SELECT * FROM *PREFIX*log WHERE 1=1 ';
$params=array();
if(isset($filter['from'])){
- $queryString.='AND `timestamp`>? ';
+ $queryString.='AND moment>? ';
array_push($params,$filter('from'));
}
if(isset($filter['until'])){
- $queryString.='AND `timestamp`<? ';
+ $queryString.='AND moment<? ';
array_push($params,$filter('until'));
}
if(isset($filter['user'])){
@@ -99,9 +99,9 @@ class OC_LOG {
}
$query=OC_DB::prepare($queryString);
$result=$query->execute($params)->fetchAll();
- if(count($result)>0 and is_numeric($result[0]['timestamp'])){
+ if(count($result)>0 and is_numeric($result[0]['moment'])){
foreach($result as &$row){
- $row['timestamp']=OC_UTIL::formatDate($row['timestamp']);
+ $row['moment']=OC_UTIL::formatDate($row['moment']);
}
}
return $result;
@@ -116,7 +116,7 @@ class OC_LOG {
* This function deletes all entries that are older than $date.
*/
public static function deleteBefore( $date ){
- $query=OC_DB::prepare("DELETE FROM *PREFIX*log WHERE `timestamp`<?");
+ $query=OC_DB::prepare("DELETE FROM *PREFIX*log WHERE moment<?");
$query->execute(array($date));
return true;
}
diff --git a/lib/preferences.php b/lib/preferences.php
index 6fb3cf1312f..5a9ed395085 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -28,8 +28,8 @@
* CREATE TABLE `preferences` (
* `userid` VARCHAR( 255 ) NOT NULL ,
* `appid` VARCHAR( 255 ) NOT NULL ,
- * `key` VARCHAR( 255 ) NOT NULL ,
- * `value` VARCHAR( 255 ) NOT NULL
+ * `configkey` VARCHAR( 255 ) NOT NULL ,
+ * `configvalue` VARCHAR( 255 ) NOT NULL
* )
*
*/
@@ -47,7 +47,7 @@ class OC_PREFERENCES{
*/
public static function getUsers(){
// No need for more comments
- $query = OC_DB::prepare( 'SELECT DISTINCT( `userid` ) FROM `*PREFIX*preferences`' );
+ $query = OC_DB::prepare( 'SELECT DISTINCT( userid ) FROM *PREFIX*preferences' );
$result = $query->execute();
$users = array();
@@ -68,7 +68,7 @@ class OC_PREFERENCES{
*/
public static function getApps( $user ){
// No need for more comments
- $query = OC_DB::prepare( 'SELECT DISTINCT( `appid` ) FROM `*PREFIX*preferences` WHERE `userid` = ?' );
+ $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM *PREFIX*preferences WHERE userid = ?' );
$result = $query->execute( array( $user ));
$apps = array();
@@ -90,12 +90,12 @@ class OC_PREFERENCES{
*/
public static function getKeys( $user, $app ){
// No need for more comments
- $query = OC_DB::prepare( 'SELECT `key` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
+ $query = OC_DB::prepare( 'SELECT configkey FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' );
$result = $query->execute( array( $user, $app ));
$keys = array();
while( $row = $result->fetchRow()){
- $keys[] = $row["key"];
+ $keys[] = $row["configkey"];
}
return $keys;
@@ -114,7 +114,7 @@ class OC_PREFERENCES{
*/
public static function getValue( $user, $app, $key, $default = null ){
// Try to fetch the value, return default if not exists.
- $query = OC_DB::prepare( 'SELECT `value` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `key` = ?' );
+ $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' );
$result = $query->execute( array( $user, $app, $key ));
if( !$result->numRows()){
@@ -123,7 +123,7 @@ class OC_PREFERENCES{
$row = $result->fetchRow();
- return $row["value"];
+ return $row["configvalue"];
}
/**
@@ -143,11 +143,11 @@ class OC_PREFERENCES{
// null: does not exist. Insert.
if( is_null( $exists )){
- $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*preferences` ( `userid`, `appid`, `key`, `value` ) VALUES( ?, ?, ?, ? )' );
+ $query = OC_DB::prepare( 'INSERT INTO *PREFIX*preferences ( userid, appid, configkey, configvalue ) VALUES( ?, ?, ?, ? )' );
$query->execute( array( $user, $app, $key, $value ));
}
else{
- $query = OC_DB::prepare( 'UPDATE `*PREFIX*preferences` SET `value` = ? WHERE `userid` = ? AND `appid` = ? AND `key` = ?' );
+ $query = OC_DB::prepare( 'UPDATE *PREFIX*preferences SET configvalue = ? WHERE userid = ? AND appid = ? AND configkey = ?' );
$query->execute( array( $value, $user, $app, $key ));
}
}
@@ -163,7 +163,7 @@ class OC_PREFERENCES{
*/
public static function deleteKey( $user, $app, $key ){
// No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `key` = ?' );
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' );
$result = $query->execute( array( $user, $app, $key ));
return true;
@@ -179,7 +179,7 @@ class OC_PREFERENCES{
*/
public static function deleteApp( $user, $app ){
// No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' );
$result = $query->execute( array( $user, $app ));
return true;
@@ -194,7 +194,7 @@ class OC_PREFERENCES{
*/
public static function deleteUser( $user ){
// No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?' );
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' );
$result = $query->execute( array( $user ));
return true;
@@ -209,7 +209,7 @@ class OC_PREFERENCES{
*/
public static function deleteAppFromAllUsers( $app ){
// No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?' );
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' );
$result = $query->execute( array( $app ));
return true;