Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
745 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<?php | ||
|
||
/** | ||
* Project: Welcompose | ||
* File: 0001-012.php | ||
* | ||
* Copyright (c) 2009 creatics | ||
* | ||
* Project owner: | ||
* creatics, Olaf Gleba | ||
* 50939 Köln, Germany | ||
* http://www.creatics.de | ||
* | ||
* This file is licensed under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE v3 | ||
* http://www.opensource.org/licenses/agpl-v3.html | ||
* | ||
* $Id$ | ||
* | ||
* @copyright 2011 creatics, Olaf Gleba | ||
* @author Olaf Gleba | ||
* @package Welcompose | ||
* @license http://www.opensource.org/licenses/agpl-v3.html GNU AFFERO GENERAL PUBLIC LICENSE v3 | ||
*/ | ||
|
||
// get loader | ||
$path_parts = array( | ||
dirname(__FILE__), | ||
'..', | ||
'..', | ||
'core', | ||
'loader.php' | ||
); | ||
$loader_path = implode(DIRECTORY_SEPARATOR, $path_parts); | ||
require($loader_path); | ||
|
||
// start base | ||
/* @var $BASE base */ | ||
$BASE = load('base:base'); | ||
|
||
// deregister globals | ||
$deregister_globals_path = dirname(__FILE__).'/../../core/includes/deregister_globals.inc.php'; | ||
require(Base_Compat::fixDirectorySeparator($deregister_globals_path)); | ||
|
||
try { | ||
// start output buffering | ||
@ob_start(); | ||
|
||
// load smarty | ||
$smarty_update_conf = dirname(__FILE__).'/../smarty.inc.php'; | ||
$BASE->utility->loadSmarty(Base_Compat::fixDirectorySeparator($smarty_update_conf), true); | ||
|
||
// load gettext | ||
$gettext_path = dirname(__FILE__).'/../../core/includes/gettext.inc.php'; | ||
include(Base_Compat::fixDirectorySeparator($gettext_path)); | ||
gettextInitSoftware($BASE->_conf['locales']['all']); | ||
|
||
// start Base_Session | ||
/* @var $SESSION session */ | ||
$SESSION = load('base:session'); | ||
|
||
// connect to database | ||
$BASE->loadClass('database'); | ||
|
||
// define major/minor task number | ||
define('TASK_MAJOR', '0001'); | ||
define('TASK_MINOR', '012'); | ||
|
||
// get schema version from database | ||
$sql = " | ||
SELECT | ||
`schema_version` | ||
FROM | ||
".WCOM_DB_APPLICATION_INFO." | ||
LIMIT | ||
1 | ||
"; | ||
$version = $BASE->db->select($sql, 'field'); | ||
list($major, $minor) = explode('-', $version); | ||
|
||
/* | ||
* References | ||
* ---------- | ||
* | ||
* Commit: 351bf87b80fd3dbc5ae32ee50b159580c2487cce | ||
* Ticket: 15 | ||
* | ||
* Changes to be applied | ||
* --------------------- | ||
* | ||
* - Add new field to table 'content_pages' | ||
* `exclude` enum ('0','1') | ||
*/ | ||
if ($major < TASK_MAJOR || ($major == TASK_MAJOR && $minor < TASK_MINOR)) { | ||
try { | ||
// begin transaction | ||
$BASE->db->begin(); | ||
|
||
// add new fields | ||
$sql = " | ||
ALTER TABLE | ||
".WCOM_DB_CONTENT_PAGES." | ||
ADD | ||
`exclude` | ||
ENUM | ||
('0', '1') NULL DEFAULT '0' | ||
AFTER `draft` | ||
"; | ||
|
||
$BASE->db->execute($sql); | ||
|
||
// update schema version | ||
$sqlData = array( | ||
'schema_version' => TASK_MAJOR.'-'.TASK_MINOR | ||
); | ||
|
||
$BASE->db->update(WCOM_DB_APPLICATION_INFO, $sqlData); | ||
|
||
// commit | ||
$BASE->db->commit(); | ||
} catch (Exception $e) { | ||
// do rollback | ||
$BASE->db->rollback(); | ||
|
||
// re-throw exception | ||
throw $e; | ||
} | ||
} | ||
|
||
// flush the buffer | ||
@ob_end_flush(); | ||
|
||
exit; | ||
} catch (Exception $e) { | ||
// clean the buffer | ||
if (!$BASE->debug_enabled()) { | ||
@ob_end_clean(); | ||
} | ||
|
||
// raise error | ||
$BASE->error->displayException($e, $BASE->utility->smarty); | ||
$BASE->error->triggerException($e); | ||
|
||
// exit | ||
exit; | ||
} | ||
|
||
?> |
Oops, something went wrong.