本文整理汇总了PHP中Cx\Lib\UpdateUtil类的典型用法代码示例。如果您正苦于以下问题:PHP UpdateUtil类的具体用法?PHP UpdateUtil怎么用?PHP UpdateUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: marketUpdates
function marketUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Market' WHERE `id` = 33");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Market' WHERE `area_id` = 98");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('33', 'Market', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Market' WHERE `module` = 'market'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$marketMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
try {
if (file_exists($marketMediaPath . '/market') && !file_exists($marketMediaPath . '/Market')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($marketMediaPath . '/market');
if (!\Cx\Lib\FileSystem\FileSystem::move($marketMediaPath . '/market', $marketMediaPath . '/Market')) {
return 'Failed to move the folder from ' . $marketMediaPath . '/market to ' . $marketMediaPath . '/Market.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Market updated successfully.';
}
示例2: calendarUpdate
function calendarUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Calendar' WHERE `id` = 21");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Calendar' WHERE `area_id` = 16");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('21', 'Calendar', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Calendar' WHERE `module` = 'calendar'");
//following queries for changing the path from images/calendar into images/Calendar
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_calendar_event` SET `pic` = REPLACE(`pic`, 'images/calendar', 'images/Calendar'),\n `attach` = REPLACE(`attach`, 'images/calendar', 'images/Calendar'),\n `place_map` = REPLACE(`place_map`, 'images/calendar', 'images/Calendar')\n WHERE `pic` LIKE ('" . ASCMS_PATH_OFFSET . "/images/calendar%') ");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/calendar';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Calendar';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Calendar Component Updated Successfully';
}
示例3: galleryUpdate
function galleryUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Gallery' WHERE `id` = 3");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Gallery' WHERE `area_id` = 12");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('3', 'Gallery', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Gallery' WHERE `module` = 'gallery'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/gallery';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Gallery';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Gallery Component Updated Successfully';
}
示例4: _podcastUpdate
function _podcastUpdate()
{
global $objDatabase, $_ARRAYLANG, $objUpdate, $_CONFIG;
//move podcast images directory
$path = ASCMS_DOCUMENT_ROOT . '/images';
$oldImagesPath = '/content/podcast';
$newImagesPath = '/podcast';
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '1.2.1')) {
if (!file_exists($path . $newImagesPath) && file_exists($path . $oldImagesPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $oldImagesPath);
if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($path . $oldImagesPath, $path . $newImagesPath)) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_TO_MOVE_DIRECTORY'], $path . $oldImagesPath, $path . $newImagesPath));
return false;
}
}
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath);
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath . '/youtube_thumbnails');
//change thumbnail paths
$query = "UPDATE `" . DBPREFIX . "module_podcast_medium` SET `thumbnail` = REPLACE(`thumbnail`, '/images/content/podcast/', '/images/podcast/')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
//set new default settings
$query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '50' WHERE `setname` = 'thumb_max_size' AND `setvalue` = ''";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '85' WHERE `setname` = 'thumb_max_size_homecontent' AND `setvalue` = ''";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
// only update if installed version is at least a version 2.0.0
// older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled
if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) {
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return $content;
}
// add missing placeholder {PODCAST_JAVASCRIPT}
if (strpos($content, '{PODCAST_JAVASCRIPT}') === false) {
$content .= "\n{PODCAST_JAVASCRIPT}";
}
// add missing placeholder {PODCAST_PAGING}
if (strpos($content, '{PODCAST_PAGING}') === false) {
$content = preg_replace('/(\\s+)(<!--\\s+END\\s+podcast_media\\s+-->)/ms', '$1$2$1<div class="noMedium">$1 {PODCAST_PAGING}$1</div>', $content);
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'podcast'), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}
return true;
}
示例5: _loginUpdate
/**
* Cloudrexx
*
* @link http://www.cloudrexx.com
* @copyright Cloudrexx AG 2007-2015
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Cloudrexx" is a registered trademark of Cloudrexx AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
function _loginUpdate()
{
global $objUpdate, $_CONFIG;
// only update if installed version is at least a version 2.0.0
// older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled
if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) {
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return null;
}
// add missing captcha template block
if (!preg_match('/<!--\\s+BEGIN\\s+captcha\\s+-->.*<!--\\s+END\\s+captcha\\s+-->/ms', $content)) {
$content = preg_replace('/(<input[^>]+name\\s*=\\s*[\'"]PASSWORD[\'"][^>]*>.*?<\\/p>)(\\s+)/ms', '$1$2<!-- BEGIN captcha -->$2<p><label for="coreCaptchaCode">{TXT_CORE_CAPTCHA}</label>{CAPTCHA_CODE}</p>$2<!-- END captcha -->', $content);
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'login', 'cmd' => ''), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}
return true;
}
示例6: accessUpdates
function accessUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Access' WHERE `id` = 23");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access', `module_id` = '23' WHERE `area_id` = 18");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access' WHERE `area_id` = 208");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('23', 'Access', 'core_module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Access' WHERE `module` = 'access'");
//update module name for crm core settings
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Access' WHERE `section` = 'access' AND `name` = 'providers' AND `group` = 'sociallogin'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$accessImgPath = ASCMS_DOCUMENT_ROOT . '/images';
try {
if (file_exists($accessImgPath . '/access') && !file_exists($accessImgPath . '/Access')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($accessImgPath . '/access');
if (!\Cx\Lib\FileSystem\FileSystem::move($accessImgPath . '/access', $accessImgPath . '/Access')) {
return 'Failed to move the folder from ' . $accessImgPath . '/access to ' . $accessImgPath . '/Access.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Access updated successfully.';
}
示例7: _recommendUpdate
function _recommendUpdate()
{
global $objDatabase;
/********************************
* EXTENSION: Captcha *
* ADDED: Contrexx v3.0.0 *
********************************/
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return $content;
}
if (!preg_match('/<!--\\s+BEGIN\\s+recommend_captcha\\s+-->.*<!--\\s+END\\s+recommend_captcha\\s+-->/ms', $content)) {
// migrate captcha stuff
$content = preg_replace('/<img[^>]+\\{RECOM_CAPTCHA_URL\\}.*\\{RECOM_CAPTCHA_OFFSET\\}[^>]+>/ms', '{RECOM_CAPTCHA_CODE}', $content);
// migration for very old versions
$content = preg_replace('/(.*)(<tr[^>]*>.*?<td[^>]*>.*?\\{RECOM_CAPTCHA_CODE\\}.*?<\\/td>.*?<\\/tr>)/ms', '$1<!-- BEGIN recommend_captcha -->$2<!-- END recommend_captcha -->', $content, -1, $count);
// migration for newer versions
if (!$count) {
$content = preg_replace('/(.*)(<p[^>]*>.*?\\{RECOM_CAPTCHA_.*?\\}.*?<\\/p>)/ms', '$1<!-- BEGIN recommend_captcha -->$2<!-- END recommend_captcha -->', $content);
}
$content = preg_replace('/(.*)(<p[^>]*><label.*<\\/label>)(.*?\\{RECOM_CAPTCHA_.*?\\}.*?)(<\\/p>)/ms', '$1$2{RECOM_CAPTCHA_CODE}$4', $content);
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'recommend'), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例8: downloadsUpdate
function downloadsUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Downloads' WHERE `id` = 53");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Downloads' WHERE `area_id` = 132");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('53', 'Downloads', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Downloads' WHERE `module` = 'downloads'");
//following queries for changing the path from images/downloads into images/Downloads
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_category`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download_locale`\n SET `source` = REPLACE(`source`, 'images/downloads', 'images/Downloads')\n WHERE `source` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/downloads';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Downloads';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Downloads Updated successfully';
}
示例9: forumUpdates
function forumUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Forum' WHERE `id` = 20");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Forum' WHERE `area_id` = 106");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('20', 'Forum', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Forum' WHERE `module` = 'forum'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$sourcePath = ASCMS_DOCUMENT_ROOT . '/media/forum';
$destinationPath = ASCMS_DOCUMENT_ROOT . '/media/Forum';
try {
if (file_exists($sourcePath) && !file_exists($destinationPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $destinationPath)) {
return 'Failed to move the folder from ' . $sourcePath . ' to ' . $destinationPath . '.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Forum updated successfully.';
}
示例10: fileSharingUpdate
function fileSharingUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'FileSharing' WHERE `id` = 68");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=media&archive=FileSharing' WHERE `area_id` = 187");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('68', 'FileSharing', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'FileSharing' WHERE `module` = 'filesharing'");
//update section
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'FileSharing',`value` = 'on' WHERE\n `section` = 'filesharing' AND `name` = 'permission' AND `group` = 'config'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/media/filesharing';
$targetPath = ASCMS_DOCUMENT_ROOT . '/media/FileSharing';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'FileSharing updated successfully';
}
示例11: _marketUpdate
/**
* Cloudrexx
*
* @link http://www.cloudrexx.com
* @copyright Cloudrexx AG 2007-2015
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Cloudrexx" is a registered trademark of Cloudrexx AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
function _marketUpdate()
{
global $objDatabase, $_ARRAYLANG;
$query = "SELECT id FROM " . DBPREFIX . "module_market_settings WHERE name='codeMode'";
$objCheck = $objDatabase->SelectLimit($query, 1);
if ($objCheck !== false) {
if ($objCheck->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_market_settings` ( `id` , `name` , `value` , `description` , `type` )\n VALUES ( NULL , 'codeMode', '1', 'TXT_MARKET_SET_CODE_MODE', '2')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market_mail');
if ($arrColumns === false) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market_mail'));
return false;
}
if (!isset($arrColumns['MAILTO'])) {
$query = "ALTER TABLE `" . DBPREFIX . "module_market_mail` ADD `mailto` VARCHAR( 10 ) NOT NULL AFTER `content`";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/*****************************************************************
* EXTENSION: New attributes 'color' and 'sort_id' for entries *
* ADDED: Contrexx v2.1.0 *
*****************************************************************/
$arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market');
if ($arrColumns === false) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market'));
return false;
}
if (!isset($arrColumns['SORT_ID'])) {
$query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `sort_id` INT( 4 ) NOT NULL DEFAULT '0' AFTER `paypal`";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
if (!isset($arrColumns['COLOR'])) {
$query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `color` VARCHAR(50) NOT NULL DEFAULT '' AFTER `description`";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
try {
// delete obsolete table contrexx_module_market_access
\Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_market_access');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_market_spez_fields', array('id' => array('type' => 'INT(5)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(100)'), 'value' => array('type' => 'VARCHAR(100)'), 'type' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '1'), 'lang_id' => array('type' => 'INT(2)', 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0')));
} catch (\Cx\Lib\UpdateException $e) {
DBG::trace();
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例12: _dataUpdate
function _dataUpdate()
{
global $objDatabase;
$arrTables = $objDatabase->MetaTables('TABLES');
if (!sizeof($arrTables)) {
return _databaseError("MetaTables('TABLES')", 'Could not read Table metadata');
}
// Create neccessary tables if not present
$tables = array('module_data_categories' => "CREATE TABLE `" . DBPREFIX . "module_data_categories` (\n `category_id` int(4) unsigned NOT NULL default '0',\n `lang_id` int(2) unsigned NOT NULL default '0',\n `is_active` enum('0','1') NOT NULL default '1',\n `parent_id` int(10) unsigned NOT NULL default '0',\n `name` varchar(100) NOT NULL default '',\n `active` enum('0','1') NOT NULL default '1',\n `cmd` int(10) unsigned NOT NULL default '1',\n `action` enum('content','overlaybox','subcategories') NOT NULL default 'content',\n `sort` int(10) unsigned NOT NULL default '1',\n `box_height` int(10) unsigned NOT NULL default '500',\n `box_width` int(11) NOT NULL default '350',\n `template` text NOT NULL,\n PRIMARY KEY (`category_id`,`lang_id`)\n ) ENGINE=InnoDB", 'module_data_message_to_category' => "CREATE TABLE `" . DBPREFIX . "module_data_message_to_category` (\n `message_id` int(6) unsigned NOT NULL default '0',\n `category_id` int(4) unsigned NOT NULL default '0',\n `lang_id` int(2) unsigned NOT NULL default '0',\n PRIMARY KEY (`message_id`,`category_id`,`lang_id`),\n KEY `category_id` (`category_id`)\n ) ENGINE=InnoDB", 'module_data_messages' => "CREATE TABLE `" . DBPREFIX . "module_data_messages` (\n `message_id` int(6) unsigned NOT NULL auto_increment,\n `user_id` int(5) unsigned NOT NULL default '0',\n `time_created` int(14) unsigned NOT NULL default '0',\n `time_edited` int(14) unsigned NOT NULL default '0',\n `hits` int(7) unsigned NOT NULL default '0',\n `active` enum('0','1') NOT NULL default '1',\n `sort` int(10) unsigned NOT NULL default '1',\n `mode` set('normal','forward') NOT NULL default 'normal',\n `release_time` int(15) NOT NULL default '0',\n `release_time_end` int(15) NOT NULL default '0',\n PRIMARY KEY (`message_id`)\n ) ENGINE=InnoDB", 'module_data_settings' => "CREATE TABLE `" . DBPREFIX . "module_data_settings` (\n `name` varchar(50) NOT NULL default '',\n `value` text NOT NULL,\n PRIMARY KEY (`name`)\n ) ENGINE=InnoDB");
///////////////////////////////////////////////////////////////////
// Create tables //
///////////////////////////////////////////////////////////////////
foreach ($tables as $name => $query) {
if (in_array(DBPREFIX . $name, $arrTables)) {
continue;
}
if (!$objDatabase->Execute($query)) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
// TODO: Unused
// $installed[] = $name;
}
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_data_placeholders', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'SET(\'cat\',\'entry\')', 'notnull' => true, 'default' => ''), 'ref_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'placeholder' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '')), array('placeholder' => array('fields' => array('placeholder'), 'type' => 'UNIQUE'), 'type' => array('fields' => array('type', 'ref_id'), 'type' => 'UNIQUE')));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$settings_query = "\nINSERT INTO `" . DBPREFIX . "module_data_settings` (`name`, `value`) VALUES\n('data_block_activated', '0'),\n('data_block_messages', '3'),\n('data_comments_activated', '1'),\n('data_comments_anonymous', '1'),\n('data_comments_autoactivate', '1'),\n('data_comments_editor', 'wysiwyg'),\n('data_comments_notification', '1'),\n('data_comments_timeout', '30'),\n('data_entry_action', 'overlaybox'),\n('data_general_introduction', '150'),\n('data_rss_activated', '0'),\n('data_rss_comments', '10'),\n('data_rss_messages', '5'),\n('data_tags_hitlist', '5'),\n('data_target_cmd', '1'),\n('data_template_category',\n'<!-- BEGIN datalist_category -->\n<!-- this displays the category and the subcategories -->\n<div class=\\\"datalist_block\\\">\n<dl>\n <!-- BEGIN category -->\n <dt class=\\\"cattitle\\\"><div class=\\\"bg\\\"><h4>[[CATTITLE]]</h4></div></dt>\n <dd class=\\\"catcontent\\\">\n <dl>\n <!-- BEGIN entry -->\n <dt>[[TITLE]]</dt>\n <dd>\n [[IMAGE]] [[CONTENT]] <a href=\\\"[[HREF]]\\\" [[CLASS]] [[TARGET]]>[[TXT_MORE]]</a>\n <br style=\\\"clear: both;\\\" />\n </dd>\n <!-- END entry -->\n </dl>\n </dd>\n <!-- END category -->\n</dl>\n</div>\n<!-- END datalist_category -->\n<!-- BEGIN datalist_single_category-->\n<!-- this displays just the entries of the category -->\n<div class=\\\"datalist_block\\\">\n<dl>\n <!-- BEGIN single_entry -->\n <dt class=\\\"cattitle\\\"><div class=\\\"bg\\\"><h4>[[TITLE]]</h4></div></dt>\n <dd class=\\\"catcontent2\\\">\n [[IMAGE]] <p>[[CONTENT]] <a href=\\\"[[HREF]]\\\" [[CLASS]] [[TARGET]]>[[TXT_MORE]]</a></p>\n <div style=\\\"clear: both;\\\" />\n </dd>\n <!-- END single_entry -->\n</dl>\n</div>\n<!-- END datalist_single_category -->\n'),\n('data_template_entry',\n'<!-- BEGIN datalist_entry-->\n<div class=\\\"datalist_block\\\">\n<dl>\n <dt>[[TITLE]]</dt>\n <dd>\n [[IMAGE]] [[CONTENT]] <a href=\\\"[[HREF]]\\\" [[CLASS]]>[[TXT_MORE]]</a>\n <br style=\\\"clear: both;\\\" />\n </dd>\n</dl>\n</div>\n<!-- END datalist_entry -->\n '),\n('data_template_thickbox',\n'<!-- BEGIN thickbox -->\n<dl class=\\\"data_module\\\">\n <dt><h6 style=\\\"margin-bottom:10px;\\\">[[TITLE]]</h6></dt>\n <dd style=\\\"clear:left;\\\">\n <!-- BEGIN image -->\n <img src=\\\"[[PICTURE]]\\\" style=\\\"float: left; margin-right: 5px;\\\" />\n <!-- END image -->\n [[CONTENT]]\n <!-- BEGIN attachment -->\n <img src=\\\"/themes/default/images/arrow.gif\\\" width=\\\"16\\\" height=\\\"8\\\" />\n <a href=\\\"javascript:void(0);\\\" onclick=\\\"window.open(\\'[[HREF]]\\', \\'attachment\\');\\\">[[TXT_DOWNLOAD]]</a>\n <!-- END attachment -->\n </dd>\n</dl>\n<!--<br /><img src=\\\"/themes/default/images/arrow.gif\\\" width=\\\"16\\\" height=\\\"8\\\" /><a onclick=\\\"Javascript:window.print();\\\" style=\\\"cursor:pointer;\\\">Drucken</a>-->\n<!-- END thickbox -->\n'),\n('data_thickbox_height', '450'),\n('data_thickbox_width', '400'),\n('data_voting_activated', '0');\n";
///////////////////////////////////////////////////////////////////
// data module settings //
///////////////////////////////////////////////////////////////////
$query = "SELECT COUNT(*) AS recordcount FROM `" . DBPREFIX . "module_data_settings`";
$objResult = $objDatabase->Execute($query);
if ($objResult === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
if ($objResult->fields['recordcount'] == 0) {
// module_data_settings table is empty. Fill it with default data.
if (!$objDatabase->Execute($settings_query)) {
return _databaseError($settings_query, $objDatabase->ErrorMsg());
}
}
/*********************************************************
* EXTENSION: Thunbmail Image & Attachment description *
* ADDED: Contrexx v2.1.0 *
*********************************************************/
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_data_messages_lang', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'default' => '1'), 'subject' => array('type' => 'VARCHAR(250)', 'default' => ''), 'content' => array('type' => 'text'), 'tags' => array('type' => 'VARCHAR(250)', 'default' => ''), 'image' => array('type' => 'VARCHAR(250)', 'default' => ''), 'thumbnail' => array('type' => 'VARCHAR(250)'), 'thumbnail_type' => array('type' => 'ENUM(\'original\',\'thumbnail\')', 'default' => 'original', 'after' => 'thumbnail'), 'thumbnail_width' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'thumbnail_height' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'attachment' => array('type' => 'VARCHAR(255)', 'default' => ''), 'attachment_description' => array('type' => 'VARCHAR(255)', 'default' => ''), 'mode' => array('type' => 'SET(\'normal\',\'forward\')', 'default' => 'normal'), 'forward_url' => array('type' => 'VARCHAR(255)', 'default' => ''), 'forward_target' => array('type' => 'VARCHAR(40)', 'notnull' => false)), array(), 'InnoDB');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例13: _votingUpdate
/**
* Cloudrexx
*
* @link http://www.cloudrexx.com
* @copyright Cloudrexx AG 2007-2015
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Cloudrexx" is a registered trademark of Cloudrexx AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
function _votingUpdate()
{
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_system', array('id' => array('type' => 'INT', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'date' => array('type' => 'TIMESTAMP', 'notnull' => true, 'default_expr' => 'CURRENT_TIMESTAMP'), 'title' => array('type' => 'VARCHAR(60)', 'notnull' => true, 'default' => '', 'renamefrom' => 'name'), 'question' => array('type' => 'TEXT', 'notnull' => false), 'status' => array('type' => 'TINYINT(1)', 'notnull' => false, 'default' => 1), 'votes' => array('type' => 'INT(11)', 'notnull' => false, 'default' => 0), 'submit_check' => array('type' => "ENUM('cookie','email')", 'notnull' => true, 'default' => 'cookie'), 'additional_nickname' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_forename' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_surname' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_phone' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_street' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_zip' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_email' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_city' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_comment' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_additionaldata', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'nickname' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => '', 'renamefrom' => 'name'), 'surname' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'phone' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'street' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'zip' => array('type' => 'VARCHAR(30)', 'notnull' => true, 'default' => ''), 'city' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'email' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'comment' => array('type' => 'TEXT', 'after' => 'email'), 'voting_system_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'renamefrom' => 'voting_sytem_id'), 'date_entered' => array('type' => 'TIMESTAMP', 'notnull' => true, 'default_expr' => 'CURRENT_TIMESTAMP', 'on_update' => 'CURRENT_TIMESTAMP'), 'forename' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => '')), array('voting_system_id' => array('fields' => array('voting_system_id'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_email', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'email' => array('type' => 'VARCHAR(255)'), 'valid' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0')), array('email' => array('fields' => array('email'), 'type' => 'UNIQUE')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_rel_email_system', array('email_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'system_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'voting_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'valid' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0')), array('email_id' => array('fields' => array('email_id', 'system_id'), 'type' => 'UNIQUE')));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例14: _auctionUpdate
/**
* Cloudrexx
*
* @link http://www.cloudrexx.com
* @copyright Cloudrexx AG 2007-2015
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Cloudrexx" is a registered trademark of Cloudrexx AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
function _auctionUpdate()
{
try {
// delete obsolete table contrexx_module_auction_access
\Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_auction_access');
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
DBG::trace();
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例15: _searchUpdate
/**
* Cloudrexx
*
* @link http://www.cloudrexx.com
* @copyright Cloudrexx AG 2007-2015
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Cloudrexx" is a registered trademark of Cloudrexx AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
function _searchUpdate()
{
/*********************************************************
* EXTENSION: Change name of HTML_Template_Sigma block *
* ADDED: Contrexx v3.0.0 *
*********************************************************/
try {
\Cx\Lib\UpdateUtil::migrateContentPage('search', null, 'searchrow', 'search_result', '3.0.0');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}