本文整理汇总了PHP中_databaseError函数的典型用法代码示例。如果您正苦于以下问题:PHP _databaseError函数的具体用法?PHP _databaseError怎么用?PHP _databaseError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_databaseError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: _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;
}
示例3: _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;
}
示例4: _galleryUpdate
function _galleryUpdate()
{
global $objDatabase, $_ARRAYLANG;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_gallery_categories', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'pid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'sorting' => array('type' => 'INT(6)', 'notnull' => true, 'default' => '0'), 'status' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'comment' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'voting' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'backendProtected' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'backend_access_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'frontendProtected' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'frontend_access_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_gallery_pictures', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'catid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'validated' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'status' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'catimg' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'sorting' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'default' => '999'), 'size_show' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'path' => array('type' => 'TEXT', 'notnull' => true), 'link' => array('type' => 'TEXT', 'notnull' => true), 'lastedit' => array('type' => 'INT(14)', 'notnull' => true, 'default' => '0'), 'size_type' => array('type' => "SET('abs', 'proz')", 'notnull' => true, 'default' => 'proz'), 'size_proz' => array('type' => "INT(3)", 'notnull' => true, 'default' => '0'), 'size_abs_h' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'size_abs_w' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'quality' => array('type' => 'TINYINT(3)', 'notnull' => true, 'default' => '0')), array('galleryPicturesIndex' => array('type' => 'FULLTEXT', 'fields' => array('path'))));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$arrSettings = array('1' => array('name' => 'max_images_upload', 'value' => '10'), '2' => array('name' => 'standard_quality', 'value' => '95'), '3' => array('name' => 'standard_size_proz', 'value' => '25'), '4' => array('name' => 'standard_width_abs', 'value' => '140'), '6' => array('name' => 'standard_height_abs', 'value' => '0'), '7' => array('name' => 'standard_size_type', 'value' => 'abs'), '8' => array('name' => 'validation_show_limit', 'value' => '10'), '9' => array('name' => 'validation_standard_type', 'value' => 'all'), '11' => array('name' => 'show_names', 'value' => 'off'), '12' => array('name' => 'quality', 'value' => '95'), '13' => array('name' => 'show_comments', 'value' => 'off'), '14' => array('name' => 'show_voting', 'value' => 'off'), '15' => array('name' => 'enable_popups', 'value' => 'on'), '16' => array('name' => 'image_width', 'value' => '1200'), '17' => array('name' => 'paging', 'value' => '30'), '18' => array('name' => 'show_latest', 'value' => 'on'), '19' => array('name' => 'show_random', 'value' => 'on'), '20' => array('name' => 'header_type', 'value' => 'hierarchy'), '21' => array('name' => 'show_ext', 'value' => 'off'), '22' => array('name' => 'show_file_name', 'value' => 'on'), '23' => array('name' => 'slide_show', 'value' => 'slideshow'), '24' => array('name' => 'slide_show_seconds', 'value' => '3'));
foreach ($arrSettings as $id => $arrSetting) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_gallery_settings` WHERE `name`= '" . $arrSetting['name'] . "'";
if (($objRS = $objDatabase->Execute($query)) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
if ($objRS->RecordCount() == 0) {
$query = "\n INSERT INTO `" . DBPREFIX . "module_gallery_settings` (`id`, `name`, `value`)\n VALUES (" . $id . ", '" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')\n ON DUPLICATE KEY UPDATE `id` = `id`\n ";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
}
/**************************************************************************
* EXTENSION: cleanup: delete translations, comments and *
* votes of inexisting pictures *
* ADDED: Contrexx v3.0.1 *
**************************************************************************/
try {
\Cx\Lib\UpdateUtil::sql('
DELETE `language_pics`
FROM `' . DBPREFIX . 'module_gallery_language_pics` as `language_pics` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `language_pics`.`picture_id`
WHERE `pictures`.`id` IS NULL
');
\Cx\Lib\UpdateUtil::sql('
DELETE `comments`
FROM `' . DBPREFIX . 'module_gallery_comments` as `comments` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `comments`.`picid`
WHERE `pictures`.`id` IS NULL
');
\Cx\Lib\UpdateUtil::sql('
DELETE `votes`
FROM `' . DBPREFIX . 'module_gallery_votes` as `votes` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `votes`.`picid`
WHERE `pictures`.`id` IS NULL
');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
// remove the script tag at the beginning of the gallery page
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'gallery'), '/^\\s*(<script[^>]+>.+?Shadowbox.+?<\\/script>)+/sm', '', array('content'), '3.0.3');
return true;
}
示例5: _u2uUpdate
function _u2uUpdate()
{
global $objDatabase;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_address_list', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'user_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'buddies_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0')), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_message_log', array('message_id' => array('type' => 'INT(11) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'message_text' => array('type' => 'TEXT', 'notnull' => true), 'message_title' => array('type' => 'TEXT', 'notnull' => true)), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_sent_messages', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'message_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'receiver_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'mesage_open_status' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'date_time' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00')), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_settings', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(50)'), 'value' => array('type' => 'TEXT')), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_settings', array('id' => array('type' => 'INT(11) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'name' => array('type' => 'VARCHAR(50)', 'notnull' => true), 'value' => array('type' => 'TEXT', 'notnull' => true)), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_user_log', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_sent_items' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_unread_items' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_status' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1')), array(), 'InnoDB');
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
/******************************************************
* EXTENSION: Initial adding of the settings values *
* ADDED: Contrexx v2.1.2 *
*******************************************************/
$arrSettings = array('max_posting_size' => '2000', 'max_posting_chars' => '2000', 'wysiwyg_editor' => '1', 'subject' => 'Eine neue Nachricht von [senderName]', 'from' => 'Contrexx U2U Nachrichtensystem', 'email_message' => 'Hallo <strong>[receiverName]</strong>,<br />\\r\\n<br />\\r\\n<strong>[senderName]</strong> hat Ihnen eine private Nachricht gesendet. Um die Nachricht zu lesen, folgen Sie bitte folgendem Link:<br />\\r\\n<br />\\r\\nhttp://[domainName]/index.php?section=u2u&cmd=notification<br />\\r\\n <br />\\r\\n<br />');
foreach ($arrSettings as $name => $value) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_u2u_settings` WHERE `name` = '" . $name . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_u2u_settings` (`name`, `value`) VALUES ('" . $name . "', '" . $value . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/********************************
* EXTENSION: Timezone *
* ADDED: Contrexx v3.0.0 *
********************************/
try {
\Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_u2u_sent_messages` CHANGE `date_time` `date_time` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例6: _knowledgeUpdate
function _knowledgeUpdate()
{
global $objDatabase;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_article_content', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'article' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'lang' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'question' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0), 'answer' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)), array('module_knowledge_article_content_lang' => array('fields' => array('lang')), 'module_knowledge_article_content_article' => array('fields' => array('article'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_articles', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'category' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 1), 'hits' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'votes' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'votevalue' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'sort' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'date_created' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0), 'date_updated' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_categories', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 1, 'unsigned' => true), 'parent' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'sort' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 1, 'unsigned' => true)), array('module_knowledge_categories_sort' => array('fields' => array('sort')), 'module_knowledge_categories_parent' => array('fields' => array('parent'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_categories_content', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'category' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 1)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_settings', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)), array('module_knowledge_settings_name' => array('fields' => array('name'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 1, 'unsigned' => true)), array('module_knowledge_tags_name' => array('fields' => array('name'))));
if (strpos(\Cx\Lib\UpdateUtil::sql('SHOW CREATE TABLE `' . DBPREFIX . 'module_knowledge_tags_articles`')->fields['Create Table'], 'UNIQUE KEY') === false) {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags_articles', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'article' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'tag' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true)), array('module_knowledge_tags_articles_tag' => array('fields' => array('tag')), 'module_knowledge_tags_articles_article' => array('fields' => array('article'))));
}
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$arrSettings = array(array('name' => 'max_subcategories', 'value' => '5'), array('name' => 'column_number', 'value' => '2'), array('name' => 'max_rating', 'value' => '8'), array('name' => 'best_rated_sidebar_template', 'value' => '<h2>Bestbewertete Artikel</h2>\\r\\n<div class="clearfix">\\r\\n<ul class="knowledge_sidebar">\\r\\n<!-- BEGIN article -->\\r\\n<li><a href="[[URL]]">[[ARTICLE]]</a></li>\\r\\n<!-- END article -->\\r\\n</ul>\\r\\n</div>'), array('name' => 'best_rated_sidebar_length', 'value' => '82'), array('name' => 'best_rated_sidebar_amount', 'value' => '5'), array('name' => 'tag_cloud_sidebar_template', 'value' => '[[CLOUD]] <br style="clear: both;" />'), array('name' => 'most_read_sidebar_template', 'value' => '<h2>Bestbewertete Artikel 2</h2>\\r\\n<div class="clearfix">\\r\\n<ul class="knowledge_sidebar">\\r\\n<!-- BEGIN article -->\\r\\n<li><a href="[[URL]]">[[ARTICLE]]</a></li>\\r\\n<!-- END article -->\\r\\n</ul>\\r\\n</div>'), array('name' => 'most_read_sidebar_length', 'value' => '79'), array('name' => 'most_read_sidebar_amount', 'value' => '5'), array('name' => 'best_rated_siderbar_template', 'value' => ''), array('name' => 'most_read_amount', 'value' => '5'), array('name' => 'best_rated_amount', 'value' => '5'));
foreach ($arrSettings as $arrSetting) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_knowledge_settings` WHERE `name` = '" . $arrSetting['name'] . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult !== false) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_knowledge_settings` (`name`, `value`) VALUES ('" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/*******************************************
* EXTENSION: Duplicate entries clean up *
* ADDED: Contrexx v3.0.2 *
*******************************************/
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags_articles', array('article' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'tag' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'article')), array('article' => array('fields' => array('article', 'tag'), 'type' => 'UNIQUE', 'force' => true)), 'MyISAM');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例7: _ecardUpdate
function _ecardUpdate()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_ecards', array('code' => array('type' => 'VARCHAR(35)', 'notnull' => true, 'default' => '', 'primary' => true), 'date' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'TTL' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'salutation' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'message' => array('type' => 'TEXT', 'notnull' => true)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_settings', array('setting_name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'primary' => true), 'setting_value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$ins_tpl = "\n INSERT INTO " . DBPREFIX . "module_ecard_settings (setting_name, setting_value)\n VALUES ('%s', '%s')\n ON DUPLICATE KEY UPDATE `setting_name` = `setting_name`\n ";
$insert_values = array(array('maxCharacters', '100'), array('maxLines', '50'), array('motive_0', 'Bild_001.jpg'), array('motive_1', 'Bild_002.jpg'), array('motive_2', ''), array('motive_3', ''), array('motive_4', ''), array('motive_5', ''), array('motive_6', ''), array('motive_7', ''), array('motive_8', ''), array('maxHeight', '300'), array('validdays', '30'), array('maxWidth', '300'), array('maxHeightThumb', '80'), array('maxWidthThumb', '80'), array('subject', 'Sie haben eine E-Card erhalten!'), array('emailText', "[[ECARD_SENDER_NAME]] hat Ihnen eine E-Card geschickt.<br />\n Sie können diese während den nächsten [[ECARD_VALID_DAYS]] Tagen unter [[ECARD_URL]] abrufen."));
foreach ($insert_values as $setting) {
$query = sprintf($ins_tpl, addslashes($setting[0]), addslashes($setting[1]));
if (!$objDatabase->Execute($query)) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/* * **********************************************
* BUGFIX: Set write access to the image dir *
* ********************************************** */
$arrImagePaths = array(array(ASCMS_DOCUMENT_ROOT . '/images/modules/ecard', ASCMS_PATH_OFFSET . '/images/modules/ecard'), array(ASCMS_ECARD_OPTIMIZED_PATH, ASCMS_ECARD_OPTIMIZED_WEB_PATH), array(ASCMS_ECARD_SEND_ECARDS_PATH, ASCMS_ECARD_SEND_ECARDS_WEB_PATH), array(ASCMS_ECARD_THUMBNAIL_PATH, ASCMS_ECARD_THUMBNAIL_WEB_PATH));
foreach ($arrImagePaths as $arrImagePath) {
if (\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0])) {
if ($mediaDir = @opendir($arrImagePath[0])) {
while ($file = readdir($mediaDir)) {
if ($file != '.' && $file != '..') {
if (!\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0] . '/' . $file)) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], $arrImagePath[0] . '/' . $file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
}
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
}
return true;
}
示例8: _jobsUpdate
/**
* 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 _jobsUpdate()
{
global $objDatabase;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs', array('id' => array('type' => 'INT(6)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'date' => array('type' => 'INT(14)', 'notnull' => false), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'author' => array('type' => 'VARCHAR(150)', 'notnull' => true, 'default' => ''), 'text' => array('type' => 'MEDIUMTEXT'), 'workloc' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'workload' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'work_start' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0), 'catid' => array('type' => 'INT(2)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'lang' => array('type' => 'INT(2)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'userid' => array('type' => 'INT(6)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'startdate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'enddate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => 1), 'changelog' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)), array('newsindex' => array('fields' => array('title', 'text'), 'type' => 'fulltext')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_categories', array('catid' => array('type' => 'INT(2)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(100)', 'default' => ''), 'lang' => array('type' => 'INT(2)', 'default' => 1, 'unsigned' => true), 'sort_style' => array('type' => "ENUM('alpha', 'date', 'date_alpha')", 'default' => 'alpha')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_location', array('id' => array('type' => 'INT(10)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(100)', 'default' => '')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_rel_loc_jobs', array('job' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'location' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_settings', array('id' => array('type' => 'INT(10)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(250)', 'default' => ''), 'value' => array('type' => 'TEXT', 'default' => '')));
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$arrSettings = array(array('name' => 'footnote', 'value' => 'Hat Ihnen diese Bewerbung zugesagt? \\r\\nDann können Sie sich sogleich telefonisch, per E-mail oder Web Formular bewerben.'), array('name' => 'link', 'value' => 'Online für diese Stelle bewerben.'), array('name' => 'url', 'value' => 'index.php?section=contact&cmd=5&44=%URL%&43=%TITLE%'), array('name' => 'show_location_fe', 'value' => '1'));
foreach ($arrSettings as $arrSetting) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_jobs_settings` WHERE `name` = '" . $arrSetting['name'] . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult !== false) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_jobs_settings` (`name`, `value`) VALUES ('" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/********************************
* EXTENSION: Timezone *
* ADDED: Contrexx v3.0.0 *
********************************/
try {
\Cx\Lib\UpdateUtil::sql('
ALTER TABLE `' . DBPREFIX . 'module_jobs`
CHANGE `startdate` `startdate` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00",
CHANGE `enddate` `enddate` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"
');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例9: _feedUpdate
/**
* 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 _feedUpdate()
{
global $objDatabase, $_ARRAYLANG;
$query = "ALTER TABLE `" . DBPREFIX . "module_feed_newsml_documents` CHANGE `publicIdentifier` `publicIdentifier` VARCHAR( 255 ) NOT NULL DEFAULT ''";
if (!$objDatabase->Execute($query)) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$arrIndexes = $objDatabase->MetaIndexes(DBPREFIX . 'module_feed_newsml_documents');
if ($arrIndexes !== false) {
if (!isset($arrIndexes['unique'])) {
$query = "ALTER TABLE `" . DBPREFIX . "module_feed_newsml_documents` ADD UNIQUE `unique` (`publicIdentifier`)";
if (!$objDatabase->Execute($query)) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_feed_newsml_documents'));
return false;
}
return true;
}
示例10: _blogUpdate
function _blogUpdate()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG, $objUpdate, $_CONFIG;
/*
* Check for missing setting "blog_comments_editor" in database. In the update-package for 1.2 this value somehow
* got lost.
*/
$query = ' SELECT name
FROM `' . DBPREFIX . 'module_blog_settings`
WHERE name="blog_comments_editor"
LIMIT 1';
$objResult = $objDatabase->Execute($query);
if ($objResult !== false) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_blog_settings` ( `name` , `value` ) VALUES ('blog_comments_editor', 'wysiwyg')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_categories', array('category_id' => array('type' => 'INT(4)', '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\')', 'notnull' => true, 'default' => '1'), 'name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_comments', array('comment_id' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'time_created' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0'), 'user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_name' => array('type' => 'VARCHAR(50)', 'notnull' => false), 'user_mail' => array('type' => 'VARCHAR(250)', 'notnull' => false), 'user_www' => array('type' => 'VARCHAR(255)', 'notnull' => false), 'subject' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'comment' => array('type' => 'TEXT')), array('message_id' => array('fields' => array('message_id'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_message_to_category', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'category_id' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)), array('category_id' => array('fields' => array('category_id'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_messages', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_created' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_edited' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'hits' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'default' => '0')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_networks_lang', array('network_id' => array('type' => 'INT(8)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_votes', array('vote_id' => array('type' => 'INT(8)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_voted' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0'), 'vote' => array('type' => 'ENUM(\'1\',\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\',\'10\')', 'notnull' => true, 'default' => '1')), array('message_id' => array('fields' => array('message_id'))));
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
try {
//update to 2.2.3 in this block
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.2.3')) {
//we've hidden the wysiwyg - let's default to textarea
\Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_blog_settings SET value="textarea" WHERE name="blog_comments_editor"');
//comments: convert escaped db entries to their unescaped equivalents
$rs = \Cx\Lib\UpdateUtil::sql('SELECT comment_id, comment FROM ' . DBPREFIX . 'module_blog_comments');
while (!$rs->EOF) {
$content = $rs->fields['comment'];
$id = $rs->fields['comment_id'];
$content = contrexx_raw2db(html_entity_decode($content, ENT_QUOTES, CONTREXX_CHARSET));
\Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_blog_comments SET comment="' . $content . '" WHERE comment_id=' . $id);
$rs->MoveNext();
}
}
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return $content;
}
// replace placeholder {TXT_COMMENT_ADD_SPAM} with {TXT_COMMENT_CAPTCHA}
$content = str_replace('{TXT_COMMENT_ADD_SPAM}', '{TXT_COMMENT_CAPTCHA}', $content);
// replace <img src="[[BLOG_DETAILS_COMMENT_ADD_SPAM_URL]]" alt="[[BLOG_DETAILS_COMMENT_ADD_SPAM_ALT]]" title="[[BLOG_DETAILS_COMMENT_ADD_SPAM_ALT]]" /> with {COMMENT_CAPTCHA_CODE}
$content = preg_replace('/<img[^>]+\\{BLOG_DETAILS_COMMENT_ADD_SPAM_URL\\}[^>]+>/ms', '{COMMENT_CAPTCHA_CODE}', $content);
// remove <input type="text" name="frmAddComment_Captcha" />
$content = preg_replace('/<input[^>]+name\\s*=\\s*[\'"]frmAddComment_Captcha[^>]+>/ms', '', $content);
// remove <input type="hidden" name="frmAddComment_Offset" value="[[BLOG_DETAILS_COMMENT_ADD_SPAM_OFFSET]]" />
$content = preg_replace('/<(div|p)[^>]*>\\s*<input[^>]+name\\s*=\\s*[\'"]frmAddComment_Offset[^>]+>\\s*<\\/(div|p)>/ms', '', $content);
// add missing comment_captcha template block
if (!preg_match('/<!--\\s+BEGIN\\s+comment_captcha\\s+-->.*<!--\\s+END\\s+comment_captcha\\s+-->/ms', $content)) {
$content = preg_replace('/(.*)(<(div|p)[^{]*?>.*?\\{TXT_COMMENT_CAPTCHA\\}.*?\\{COMMENT_CAPTCHA_CODE\\}.*?<\\/\\3>)/ms', '$1<!-- BEGIN comment_captcha -->$2<!-- END comment_captcha -->', $content, -1, $count);
if (!$count) {
$content = preg_replace('/(.*)(<(div|p)[^{]*?>.*?\\{COMMENT_CAPTCHA_CODE\\}.*?<\\/\\3>)/ms', '$1<!-- BEGIN comment_captcha -->$2<!-- END comment_captcha -->', $content, -1, $count);
}
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'blog', 'cmd' => 'details'), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
/**
* Everything went fine. Return without any errors.
*/
return true;
}
示例11: _downloadsUpdate
/**
* 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 _downloadsUpdate()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG, $objUpdate, $_CONFIG;
/************************************************
* EXTENSION: Initial creation of the *
* database tables *
* ADDED: Contrexx v2.1.0 *
************************************************/
$arrTables = $objDatabase->MetaTables('TABLES');
if (!sizeof($arrTables)) {
setUpdateMsg($_ARRAYLANG['TXT_UNABLE_DETERMINE_DATABASE_STRUCTURE']);
return false;
}
$tables = array(DBPREFIX . 'module_downloads_category' => "CREATE TABLE `" . DBPREFIX . "module_downloads_category` (\n `id` int(11) unsigned NOT NULL auto_increment,\n `parent_id` int(11) unsigned NOT NULL default '0',\n `is_active` tinyint(1) unsigned NOT NULL default '1',\n `visibility` tinyint(1) unsigned NOT NULL default '1',\n `owner_id` int(5) unsigned NOT NULL default '0',\n `order` int(3) unsigned NOT NULL default '0',\n `deletable_by_owner` tinyint(1) unsigned NOT NULL default '1',\n `modify_access_by_owner` tinyint(1) unsigned NOT NULL default '1',\n `read_access_id` int(11) unsigned NOT NULL default '0',\n `add_subcategories_access_id` int(11) unsigned NOT NULL default '0',\n `manage_subcategories_access_id` int(11) unsigned NOT NULL default '0',\n `add_files_access_id` int(11) unsigned NOT NULL default '0',\n `manage_files_access_id` int(11) unsigned NOT NULL default '0',\n `image` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `is_active` (`is_active`),\n KEY `visibility` (`visibility`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_category_locale' => "CREATE TABLE `" . DBPREFIX . "module_downloads_category_locale` (\n `lang_id` int(11) unsigned NOT NULL default '0',\n `category_id` int(11) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n PRIMARY KEY (`lang_id`,`category_id`),\n FULLTEXT KEY `name` (`name`),\n FULLTEXT KEY `description` (`description`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_download_locale' => "CREATE TABLE `" . DBPREFIX . "module_downloads_download_locale` (\n `lang_id` int(11) unsigned NOT NULL default '0',\n `download_id` int(11) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n PRIMARY KEY (`lang_id`,`download_id`),\n FULLTEXT KEY `name` (`name`),\n FULLTEXT KEY `description` (`description`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_rel_download_category' => "CREATE TABLE `" . DBPREFIX . "module_downloads_rel_download_category` (\n `download_id` int(10) unsigned NOT NULL default '0',\n `category_id` int(10) unsigned NOT NULL default '0',\n `order` int(3) unsigned NOT NULL default '0',\n PRIMARY KEY (`download_id`,`category_id`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_rel_download_download' => "CREATE TABLE `" . DBPREFIX . "module_downloads_rel_download_download` (\n `id1` int(10) unsigned NOT NULL default '0',\n `id2` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id1`,`id2`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_settings' => "CREATE TABLE `" . DBPREFIX . "module_downloads_settings` (\n `id` int(11) NOT NULL auto_increment,\n `name` varchar(32) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM");
foreach ($tables as $name => $query) {
#print_r($arrTables);
if (in_array($name, $arrTables)) {
continue;
}
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_download', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'ENUM(\'file\',\'url\')', 'notnull' => true, 'default' => 'file'), 'mime_type' => array('type' => 'ENUM(\'image\',\'document\',\'pdf\',\'media\',\'archive\',\'application\',\'link\')', 'notnull' => true, 'default' => 'image'), 'source' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'source_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'icon' => array('type' => 'ENUM(\'_blank\',\'avi\',\'bmp\',\'css\',\'doc\',\'dot\',\'exe\',\'fla\',\'gif\',\'htm\',\'html\',\'inc\',\'jpg\',\'js\',\'mp3\',\'nfo\',\'pdf\',\'php\',\'png\',\'pps\',\'ppt\',\'rar\',\'swf\',\'txt\',\'wma\',\'xls\',\'zip\')', 'notnull' => true, 'default' => '_blank'), 'size' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'image' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'owner_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'license' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'version' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => ''), 'author' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'website' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'ctime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'mtime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'is_active' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'visibility' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1'), 'order' => array('type' => 'INT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'views' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'download_count' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'expiration' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'validity' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0')), array('is_active' => array('fields' => array('is_active')), 'visibility' => array('fields' => array('visibility'))));
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
/************************************************
* EXTENSION: Initial adding of the *
* settings values *
* ADDED: Contrexx v2.1.0 *
************************************************/
$arrSettings = array('overview_cols_count' => '2', 'overview_max_subcats' => '5', 'use_attr_size' => '1', 'use_attr_license' => '1', 'use_attr_version' => '1', 'use_attr_author' => '1', 'use_attr_website' => '1', 'most_viewed_file_count' => '5', 'most_downloaded_file_count' => '5', 'most_popular_file_count' => '5', 'newest_file_count' => '5', 'updated_file_count' => '5', 'new_file_time_limit' => '604800', 'updated_file_time_limit' => '604800', 'associate_user_to_groups' => '');
foreach ($arrSettings as $name => $value) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_downloads_settings` WHERE `name` = '" . $name . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_downloads_settings` (`name`, `value`) VALUES ('" . $name . "', '" . $value . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/************************************************
* BUGFIX: Set write access to the upload dir *
************************************************/
if (\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_DOWNLOADS_IMAGES_PATH)) {
if ($mediaDir = @opendir(ASCMS_DOWNLOADS_IMAGES_PATH)) {
while ($file = readdir($mediaDir)) {
if ($file != '.' && $file != '..') {
if (!\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_DOWNLOADS_IMAGES_PATH . '/' . $file)) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], ASCMS_DOWNLOADS_IMAGES_PATH . '/' . $file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
}
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_DOWNLOADS_IMAGES_PATH . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
} else {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_DOWNLOADS_IMAGES_PATH . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
return false;
}
/************************************************
* EXTENSION: Groups *
* ADDED: Contrexx v2.1.2 *
************************************************/
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_group', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'is_active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '1'), 'type' => array('type' => 'ENUM(\'file\',\'url\')', 'notnull' => true, 'default' => 'file'), 'info_page' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '')));
//.........这里部分代码省略.........
示例12: _updateModuleRepository
function _updateModuleRepository()
{
global $_CORELANG, $objUpdate, $objDatabase;
$count = 0;
$dh = opendir(dirname(__FILE__) . '/components/core');
if ($dh) {
$query = "TRUNCATE TABLE " . DBPREFIX . "module_repository";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_repository', array('id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true), 'moduleid' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'id'), 'content' => array('type' => 'mediumtext', 'after' => 'moduleid'), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'content'), 'cmd' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => '', 'after' => 'title'), 'expertmode' => array('type' => 'SET(\'y\',\'n\')', 'notnull' => true, 'default' => 'n', 'after' => 'cmd'), 'parid' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'expertmode'), 'displaystatus' => array('type' => 'SET(\'on\',\'off\')', 'notnull' => true, 'default' => 'on', 'after' => 'parid'), 'username' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'displaystatus'), 'displayorder' => array('type' => 'SMALLINT(6)', 'notnull' => true, 'default' => '100', 'after' => 'username')), array('contentid' => array('fields' => array('id'), 'type' => 'UNIQUE'), 'fulltextindex' => array('fields' => array('title', 'content'), 'type' => 'FULLTEXT')));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
while (($file = readdir($dh)) !== false) {
if (preg_match('#^repository_([0-9]+)\\.php$#', $file, $arrFunction)) {
if (!in_array($file, ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
if (function_exists('memory_get_usage')) {
if (!checkMemoryLimit()) {
return false;
}
} else {
$count++;
}
if (!(include_once dirname(__FILE__) . '/components/core/' . $file)) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/' . $file));
return false;
}
$function = '_updateModuleRepository_' . $arrFunction[1];
if (function_exists($function)) {
DBG::msg("---------------------- update: calling {$function}() ---------");
$result = $function();
if ($result === false) {
DBG::msg("---------------------- update: calling {$function}() failed ---------");
if (empty($objUpdate->arrStatusMsg['title'])) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $file), 'title');
}
return false;
}
} else {
DBG::msg("---------------------- update: calling {$function}() failed, function does not exist ---------");
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UPDATE_COMPONENT_CORRUPT'], $_CORELANG['TXT_UPDATE_MODULE_REPOSITORY'], $arrFunction[1]));
return false;
}
$_SESSION['contrexx_update']['update']['done'][] = $file;
if ($count == 10) {
setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED'], 'title');
setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED_RAM_MSG'] . '<br /><br />', 'msg');
setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
return false;
}
}
}
}
} else {
setUpdateMsg($_CORELANG['TXT_UPDATE_UNABLE_LOAD_REPOSITORY_PARTS']);
return false;
}
closedir($dh);
return true;
}
示例13: _docsysUpdate
function _docsysUpdate()
{
global $objDatabase, $_ARRAYLANG;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_docsys_entry_category', array('entry' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'category' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)));
if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_docsys', 'catid')) {
$query = "SELECT `id`, `catid` FROM `" . DBPREFIX . "module_docsys`";
$objResult = $objDatabase->Execute($query);
if ($objResult !== false) {
while (!$objResult->EOF) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_docsys_entry_category` WHERE `entry` = " . $objResult->fields['id'] . " AND `category` = " . $objResult->fields['catid'];
$objCheck = $objDatabase->SelectLimit($query, 1);
if ($objCheck !== false) {
if ($objCheck->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_docsys_entry_category` (`entry`, `category`) VALUES ('" . $objResult->fields['id'] . "', '" . $objResult->fields['catid'] . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$objResult->MoveNext();
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
// Fix some fuckup that UpdatUtil can't do.. make sure that "id" is unique before attempting
// to make it a primary key
$duplicateIDs_sql = "SELECT COUNT(*) as c, id FROM " . DBPREFIX . "module_docsys GROUP BY id HAVING c > 1";
$duplicateIDs = $objDatabase->Execute($duplicateIDs_sql);
if ($duplicateIDs === false) {
return _databaseError($duplicateIDs_sql, $objDatabase->ErrorMsg());
}
$fix_queries = array();
while (!$duplicateIDs->EOF) {
$id = $duplicateIDs->fields['id'];
$entries_sql = "SELECT * FROM " . DBPREFIX . "module_docsys WHERE id = {$id}";
$entries = $objDatabase->Execute($entries_sql);
if ($entries === false) {
return _databaseError($entries_sql, $objDatabase->ErrorMsg());
}
// NOW: put them all in an array, DELETE them and then re-INSERT them
// without id. the auto_increment will take care of the rest. The first one we
// re-insert can keep it's id.
$entries_sql = "SELECT * FROM " . DBPREFIX . "module_docsys WHERE id = {$id}";
$entries = $objDatabase->Execute($entries_sql);
if ($entries === false) {
return _databaseError($entries_sql, $objDatabase->ErrorMsg());
}
$is_first = true;
$fix_queries[] = "DELETE FROM " . DBPREFIX . "module_docsys WHERE id = {$id}";
while (!$entries->EOF) {
$pairs = array();
foreach ($entries->fields as $k => $v) {
// only first may keep it's id
if ($k == 'id' and !$is_first) {
continue;
}
$pairs[] = "{$k} = '" . addslashes($v) . "'";
}
$fix_queries[] = "INSERT INTO " . DBPREFIX . "module_docsys SET " . join(', ', $pairs);
$is_first = false;
$entries->MoveNext();
}
$duplicateIDs->MoveNext();
}
// Now run all of these queries. basically DELETE, INSERT,INSERT, DELETE,INSERT...
foreach ($fix_queries as $insert_query) {
if ($objDatabase->Execute($insert_query) === false) {
return _databaseError($insert_query, $objDatabase->ErrorMsg());
}
}
// alter column startdate from date to int
$arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_docsys');
if ($arrColumns === false) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_docsys'));
return false;
}
if (isset($arrColumns['STARTDATE'])) {
if ($arrColumns['STARTDATE']->type == 'date') {
if (!isset($arrColumns['STARTDATE_NEW'])) {
$query = 'ALTER TABLE `' . DBPREFIX . 'module_docsys` ADD `startdate_new` INT(14) UNSIGNED NOT NULL DEFAULT \'0\' AFTER `startdate`';
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
$query = 'UPDATE `' . DBPREFIX . 'module_docsys` SET `startdate_new` = UNIX_TIMESTAMP(`startdate`) WHERE `startdate` != \'0000-00-00\'';
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$query = 'ALTER TABLE `' . DBPREFIX . 'module_docsys` DROP `startdate`';
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
}
$arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_docsys');
if ($arrColumns === false) {
//.........这里部分代码省略.........
示例14: DefaultActionHandler
public static function DefaultActionHandler($e)
{
if ($e instanceof Update_DatabaseException) {
return _databaseError($e->sql, $e->getMessage());
}
setUpdateMsg($e->getMessage());
return false;
}
示例15: _coreUpdate
/**
* 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 _coreUpdate()
{
global $objUpdate, $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG;
$query = "SELECT `id` FROM `" . DBPREFIX . "languages` WHERE `charset` != 'UTF-8'";
$objResult = $objDatabase->Execute($query);
if ($objResult !== false) {
while (!$objResult->EOF) {
$query = "UPDATE `" . DBPREFIX . "languages` SET `charset` = 'UTF-8' WHERE `id`=" . $objResult->fields['id'];
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$objResult->MoveNext();
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$query = "SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE `access_id` = '5' GROUP BY `group_id`";
$objGroup = $objDatabase->Execute($query);
if ($objGroup !== false) {
while (!$objGroup->EOF) {
$query = "INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`) VALUES ('127', '" . $objGroup->fields['group_id'] . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$objGroup->MoveNext();
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
/*if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0')) {
$query = "SELECT `catid` FROM `".DBPREFIX."content_navigation`";
$objContentNavigation = $objDatabase->Execute($query);
if ($objContentNavigation !== false) {
$arrContentSiteIds = array();
while (!$objContentNavigation->EOF) {
array_push($arrContentSiteIds, $objContentNavigation->fields['catid']);
$objContentNavigation->MoveNext();
}
$query = "DELETE FROM `".DBPREFIX."content` WHERE `id` != ".implode(' AND `id` != ', $arrContentSiteIds);
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
try {
\Cx\Lib\UpdateUtil::table(
DBPREFIX.'content_navigation',
array(
'catid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true),
'is_validated' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'),
'parcat' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'),
'catname' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''),
'target' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => ''),
'displayorder' => array('type' => 'SMALLINT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '1000'),
'displaystatus' => array('type' => 'SET(\'on\',\'off\')', 'notnull' => true, 'default' => 'on'),
'activestatus' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'),
'cachingstatus' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'),
'username' => array('type' => 'VARCHAR(40)', 'notnull' => true, 'default' => ''),
'changelog' => array('type' => 'INT(14)', 'notnull' => false),
'cmd' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => ''),
'lang' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1'),
'module' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'),
'startdate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'),
'enddate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'),
'protected' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '0'),
'frontend_access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'),
'backend_access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'),
'themes_id' => array('type' => 'INT(4)', 'notnull' => true, 'default' => '0'),
'css_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''),
'custom_content' => array('type' => 'VARCHAR(64)', 'after' => 'css_name', 'default' => '')
),
array(
'parcat' => array('fields' => array('parcat')),
//.........这里部分代码省略.........