allow objs to represent inventory

This commit is contained in:
redmatrix 2016-05-27 23:57:47 -07:00
parent ab6eb1c4b2
commit ac4688eac0
4 changed files with 25 additions and 4 deletions

View File

@ -48,7 +48,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '1.7.1' );
define ( 'ZOT_REVISION', 1.1 );
define ( 'DB_UPDATE_VERSION', 1168 );
define ( 'DB_UPDATE_VERSION', 1169 );
/**
@ -691,7 +691,7 @@ function startup() {
class ZotlabsAutoloader {
static public function loader($className) {
$filename = str_replace('\\', '/', $className) . ".php";
if (file_exists($filename)) {
if(file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return TRUE;
@ -702,7 +702,7 @@ class ZotlabsAutoloader {
if(! $arr[0])
$arr = array_shift($arr);
$filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php");
if (file_exists($filename)) {
if(file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return TRUE;

View File

@ -883,6 +883,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
`obj_imgurl` char(255) NOT NULL DEFAULT '',
`obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_quantity` int(11) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@ -897,6 +898,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
KEY `obj_imgurl` (`obj_imgurl`),
KEY `obj_created` (`obj_created`),
KEY `obj_edited` (`obj_edited`),
KEY `obj_quantity` (`obj_quantity`),
KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -873,6 +873,7 @@ CREATE TABLE "obj" (
"obj_imgurl" char(255) NOT NULL DEFAULT '',
"obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_quantity" int(11) NOT NULL DEFAUL '0'.
"allow_cid" text NOT NULL,
"allow_gid" text NOT NULL,
"deny_cid" text NOT NULL,
@ -890,6 +891,7 @@ create index "obj_url" on obj ("obj_url");
create index "obj_imgurl" on obj ("obj_imgurl");
create index "obj_created" on obj ("obj_created");
create index "obj_edited" on obj ("obj_edited");
create index "obj_quantity" on obj ("obj_quantity");
CREATE TABLE "outq" (
"outq_hash" text NOT NULL,

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1168 );
define( 'UPDATE_VERSION' , 1169 );
/**
*
@ -2097,3 +2097,20 @@ function update_r1167() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1168() {
$r1 = q("alter table obj add obj_quantity int not null default '0' ");
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") ");
}
else {
$r2 = q("alter table obj add index ( obj_quantity ) ");
}
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}