本文整理汇总了PHP中PHPWS_DB::importFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::importFile方法的具体用法?PHP PHPWS_DB::importFile怎么用?PHP PHPWS_DB::importFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::importFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runDbMigration
function runDbMigration($fileName)
{
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/systemsinventory/boost/updates/' . $fileName);
if (PEAR::isError($result)) {
throw new \Exception($result->toString());
}
}
示例2: faxmaster_update
/**
* update.php - FaxMaster update script
*
*/
function faxmaster_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '0.1.0', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.1.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.1.2', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.2.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.1.3', '<'):
PHPWS_Core::initModClass('users', 'Permission.php');
Users_Permission::registerPermissions('faxmaster', $content);
case version_compare($currentVersion, '0.1.5', '<'):
PHPWS_Settings::set('faxmaster', 'fax_path', '/var/fax/');
PHPWS_Settings::save('faxmaster');
case version_compare($currentVersion, '0.1.6', '<'):
$content[] = '<pre>';
slcUpdateFiles(array('class/FaxPager.php', 'class/Faxmaster.php', 'templates/faxList.tpl', 'templates/style.css', 'templates/statistics.tpl'), $content);
$content[] = '0.1.6 Changes
---------------
+ Added a statistics page to view monthly fax stats.
+ Added CSV export to the new statistics page.</pre>';
case version_compare($currentVersion, '0.1.7', '<'):
$content[] = '<pre>';
// Add 2 new columns to the database related to archiving
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.7.sql');
if (PEAR::isError($result)) {
return $result;
}
slcUpdateFiles(array('boost/boost.php', 'boost/install.sql', 'boost/permission.php', 'boost/update.php', 'boost/update-0.1.7.sql', 'class/ArchiveDownload.php', 'class/exception/InstallException.php', 'class/Fax.php', 'class/FaxPager.php', 'class/Faxmaster.php', 'inc/settings.php', 'templates/archivePager.tpl', 'templates/faxList.tpl', 'templates/settings.tpl', 'templates/style.css'), $content);
$content[] = '0.1.7 Changes
---------------
+ Added an archive method that is only accessbile by URL.
+ Added the ability to Download an Archive file.
+ Added permissions related to archiving and settings.
+ Added 2 database columns needed for archiving.
+ Added a View Archive page to view a list of all archived faxes.
+ Added a Settings page to configure the fax and archive paths.
</pre>';
case version_compare($currentVersion, '0.1.8', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.8.sql');
if (PEAR::isError($result)) {
return $result;
}
}
return true;
}
示例3: appsync_update
/**
* @author Chris Detsch
*/
function appsync_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '0.1.2', '<'):
Users_Permission::registerPermissions('intern', $content);
case version_compare($currentVersion, '0.1.3', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_00.01.00.sql');
if (PEAR::isError($result)) {
return $result;
}
}
return true;
}
示例4: pulse_update
/**
* Description
* @author Jeff Tickle <jtickle at tux dot appstate dot edu>
*/
function pulse_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.9.1', '<'):
if (PHPWS_Error::logIfError(PHPWS_DB::dropTable('pulse_schedule'))) {
$content[] = 'Could not drop pulse_schedule table.';
return;
}
$result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/pulse/boost/install.sql');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Could not run install.sql.';
return;
}
$content[] = '<pre>Replaced pulse_schedule table</pre>';
case version_compare($currentVersion, '2.0.0', '<'):
if (PHPWS_Error::logIfError(PHPWS_DB::dropTable('pulse_schedule'))) {
$content[] = 'Could not drop pulse_schedule table.';
return;
}
$db = Database::newDB();
$db->begin();
try {
$pulse = new \pulse\PulseSchedule();
$st = $pulse->createTable($db);
} catch (\Exception $e) {
$error_query = $pulse->createQuery();
if (isset($st) && $db->tableExists($st->getName())) {
$st->drop();
}
$content[] = 'Query:' . $error_query;
$db->rollback();
throw $e;
}
$db->commit();
$content[] = 'New Pulse Schedule table created. ALL OLD SCHEDULES HAVE BEEN REMOVED!';
}
return TRUE;
}
示例5: createCore
public function createCore()
{
require_once 'File.php';
$this->content[] = dgettext('core', 'Importing core database file.');
$db = new PHPWS_DB();
$result = $db->importFile('core/boost/install.sql');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$this->content[] = dgettext('core', 'Some errors occurred while creating the core database tables.');
$this->content[] = dgettext('core', 'Please check your error log file.');
return false;
}
if ($result == true) {
$db = new PHPWS_DB('core_version');
include PHPWS_SOURCE_DIR . 'core/boost/boost.php';
$db->addValue('version', $version);
$result = $db->insert();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$this->content[] = dgettext('core', 'Some errors occurred while creating the core database tables.');
$this->content[] = dgettext('core', 'Please check your error log file.');
return false;
} else {
$this->content[] = dgettext('core', 'Core installation successful.');
return true;
}
}
}
示例6: calendar_update
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function calendar_update(&$content, $version)
{
switch ($version) {
case version_compare($version, '1.2.2', '<'):
$content[] = 'This package will not update any versions prior to 1.2.2.';
return false;
case version_compare($version, '1.3.0', '<'):
$result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/calendar/boost/sql_update_130.sql');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = '+ Unable to import new suggestion table.';
return false;
} else {
$files = array('templates/admin/forms/edit_event.tpl', 'templates/view/day.tpl', 'templates/view/week.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/style.css', 'templates/user_main.tpl', 'templates/admin/approval.tpl', 'conf/config.php');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '+ Template files updated successfully.';
} else {
$content[] = '+ Unable to copy template files locally.';
$content[] = '<pre>' . implode("\n", $files) . '</pre>';
}
$content[] = '+ Suggestion table import successful';
$content[] = '<pre>
1.3.0 Changes
-------------
+ Added ability to for anonymous users to make event suggestions.
+ Fixed some issues with javascript disabled users unable to make events.
+ First public schedule is made the default on creation.
</pre>';
}
case version_compare($version, '1.4.0', '<'):
$content[] = "<pre>1.4.0 Changes\n-------------";
$files = array('templates/admin/settings.tpl', 'conf/config.php');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '+ Successfully copied these files locally:';
} else {
$content[] = '+ Could not copy these files locally:';
}
$content[] = ' ' . implode("\n ", $files);
$content[] = '+ Bug #1648965. Clicking Day or Week from grid view pulls correct day
+ Changed "Today" link to view appropiate description to prevent
confusion
+ Changed time defaults to %p to work with more installs
+ If start date is greater than end date, the event will be saved to
the save day.
+ Bug #1648963. Fixed mini month not showing days with events.
+ Made event count linkable in grid view
+ Labeled some permissions "unrestricted only"
+ Added permissions checks for editing and deleting
+ Created checkPermissions function in schedule class to simplify code
+ Removed commented legacy code from Schedule.php
+ Added missing suggestion tables to install and uninstall
+ Fixed caching logic
+ Fixed default schedule loading in Calendar class
+ Fixed inability to create more than one schedule
+ Added option to disable month view caching
+ Caching now works on public calendars only.
+ Added translate functions.
+ Updated message translation files.</pre>';
case version_compare($version, '1.4.1', '<'):
$content[] = "<pre>1.4.1 Changes\n-------------";
$files = array('templates/admin/forms/edit_event.tpl', 'javascript/check_date/head.js');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '+ Successfully updated the following files:';
} else {
$content[] = '+ Unable to update the following files:';
}
$content[] = ' ' . implode("\n ", $files);
$content[] = '+ Made noon the default time for new events.
+ Fixed Daylight Saving Time breaking repeats.
+ Delete event links made secure.
+ Days made linkable in month list view.
+ Added a sync dates button on the edit event form.';
case version_compare($version, '1.5.0', '<'):
$db = new PHPWS_DB('calendar_schedule');
$result = $db->addTableColumn('show_upcoming', 'SMALLINT NOT NULL DEFAULT 0');
if (PHPWS_Error::logIfError($result)) {
$content[] = '--- Could not create show_upcoming column in calendar_schedule table.';
return false;
}
$content[] = '<pre>';
$files = array('img/calendar.png', 'conf/config.php', 'templates/admin/forms/edit_schedule.tpl', 'templates/style.css', 'templates/view/upcoming.tpl');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '-- Successfully updated the following files:';
} else {
$content[] = '-- Unable to update the following files:';
}
$content[] = ' ' . implode("\n ", $files);
$content[] = '
1.5.0 Changes
---------------------
+ Can now choose to show upcoming events.
+ Removed schedule created message when using javascript popup
+ Moved getEvents function in the Schedule class
+ Increase calendar event form\'s popup height
+ Reformated schedule form
+ Bug # 1699659 - Calendar will not show "Add Event" link if a
//.........这里部分代码省略.........
示例7: create_core
public function create_core()
{
$db = new PHPWS_DB();
$loaddb = \PHPWS_DB::loadDB($this->getDSN(), $this->dbprefix);
if (PHPWS_Error::isError($loaddb)) {
return $loaddb;
}
$result = $db->importFile(PHPWS_SOURCE_DIR . 'core/boost/install.sql');
if ($result == TRUE) {
$db->setTable('core_version');
include PHPWS_SOURCE_DIR . 'core/boost/boost.php';
$db->addValue('version', $version);
$result = $db->insert();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
return $result;
}
Branch::loadHubDB();
return true;
} else {
Branch::loadHubDB();
return $result;
}
}
示例8: install
/**
* Updated: 19 Feb 2010
* Boost used to allow pausing for entering information. This was removed.
* @param $inBoost
* @param $inBranch
* @param $home_dir
* @return unknown_type
*/
public function install($inBoost = true, $inBranch = false, $home_dir = NULL)
{
$content = array();
$dir_content = array();
if ($inBranch && !empty($home_dir)) {
$GLOBALS['boost_branch_dir'] = $home_dir;
}
if (!$this->checkDirectories($dir_content, null, false)) {
return implode('<br />', $dir_content);
}
if (!$this->isModules()) {
return PHPWS_Error::get(BOOST_NO_MODULES_SET, 'boost', 'install');
}
$last_mod = end($this->modules);
foreach ($this->modules as $title => $mod) {
$title = trim($title);
if ($this->getStatus($title) == BOOST_DONE) {
continue;
}
if ($this->getCurrent() != $title && $this->getStatus($title) == BOOST_NEW) {
$this->setCurrent($title);
$this->setStatus($title, BOOST_START);
}
$content[] = dgettext('boost', 'Installing') . ' - ' . $mod->getProperName();
if ($this->getStatus($title) == BOOST_START && $mod->isImportSQL()) {
$content[] = dgettext('boost', 'Importing SQL install file.');
$db = new PHPWS_DB();
$result = $db->importFile($mod->getDirectory() . 'boost/install.sql');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$this->addLog($title, dgettext('boost', 'Database import failed.'));
$content[] = dgettext('boost', 'An import error occurred.');
$content[] = dgettext('boost', 'Check your logs for more information.');
return implode('<br />', $content) . '<br />' . implode('<br />', $content);
} else {
$content[] = dgettext('boost', 'Import successful.');
}
}
try {
$result = $this->onInstall($mod, $content);
if ($result === true) {
$this->setStatus($title, BOOST_DONE);
$this->createDirectories($mod, $content, $home_dir);
$this->registerModule($mod, $content);
$continue = true;
} elseif ($result === -1) {
// No installation file (install.php) was found.
$this->setStatus($title, BOOST_DONE);
$this->createDirectories($mod, $content, $home_dir);
$this->registerModule($mod, $content);
$continue = true;
} elseif (PHPWS_Error::isError($result)) {
$content[] = dgettext('boost', 'There was a problem in the installation file:');
$content[] = '<b>' . $result->getMessage() . '</b>';
$content[] = '<br />';
PHPWS_Error::log($result);
$continue = false;
}
} catch (\Exception $e) {
$content[] = implode('<br />', $content);
$content[] = dgettext('boost', 'There was a problem in the installation file:');
$content[] = '<b>' . $e->getMessage() . '</b>';
$content[] = '<br />';
\Error::log($e);
$continue = false;
}
// in case install changes translate directory
}
if ($last_mod->title == $title) {
// H0120
$content[] = dgettext('boost', 'Installation complete!');
$this->addLog($title, str_replace("\n\n\n", "\n", implode("\n", str_replace('<br />', "\n", $content))));
}
return implode('<br />', $content);
}
示例9: filecabinet_update
/**
* @author Matthew McNaney
* @version $Id$
*/
function filecabinet_update(&$content, $version)
{
$home_dir = PHPWS_Boost::getHomeDir();
switch ($version) {
case version_compare($version, '1.0.1', '<'):
$content[] = '<pre>File Cabinet versions prior to 1.0.1 are not supported.
Please download version 1.0.2.</pre>';
break;
case version_compare($version, '1.0.2', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('folders');
if (!$db->isTableColumn('key_id')) {
if (PHPWS_Error::logIfError($db->addTableColumn('key_id', 'int NOT NULL default 0'))) {
$content[] = '--- An error occurred when trying to add key_id as a column to the folders table.</pre>';
return false;
}
$content[] = '--- Successfully added key_id column to folders table.';
$db2 = new PHPWS_DB('phpws_key');
$db2->addWhere('module', 'filecabinet');
$db2->delete();
$content[] = '--- Deleted false folder keys.';
$db->reset();
PHPWS_Core::initModClass('filecabinet', 'Folder.php');
$result = $db->getObjects('Folder');
if (!empty($result)) {
foreach ($result as $folder) {
$folder->saveKey(true);
}
}
}
$content[] = '
1.0.2 changes
--------------
+ 1.0.0 update was missing key_id column addition to folders table.
</pre>';
case version_compare($version, '1.1.0', '<'):
$content[] = '<pre>';
if (!checkMultimediaDir($content, $home_dir)) {
return false;
}
if (!is_dir($home_dir . 'files/filecabinet/incoming')) {
if (is_writable($home_dir . 'files/filecabinet') && @mkdir($home_dir . 'files/filecabinet/incoming')) {
$content[] = '--- "files/filecabinet/incoming" directory created.';
} else {
$content[] = 'File Cabinet 1.1.0 is unable to create a "filecabinet/incoming" directory.
It is not required but if you want to classify files you will need to create it yourself.
Example: mkdir phpwebsite/files/filecabinet/incoming/</pre>';
return false;
}
}
$source_dir = PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/filters/';
$dest_dir = $home_dir . 'templates/filecabinet/filters/';
if (!is_dir($dest_dir)) {
if (!PHPWS_File::copy_directory($source_dir, $dest_dir)) {
$content[] = '--- FAILED copying templates/filters/ directory locally.</pre>';
return false;
}
}
$files = array('templates/manager/pick.tpl', 'templates/classify_file.tpl', 'templates/classify_list.tpl', 'templates/image_edit.tpl', 'templates/multimedia_edit.tpl', 'templates/multimedia_grid.tpl', 'templates/style.css', 'templates/settings.tpl', 'conf/config.php');
if (PHPWS_Boost::updateFiles($files, 'filecabinet')) {
$content[] = '--- Copied the following files:';
} else {
$content[] = '--- FAILED copying the following files:';
}
$content[] = " " . implode("\n ", $files);
$db = new PHPWS_DB('images');
if (!$db->isTableColumn('parent_id')) {
if (PHPWS_Error::logIfError($db->addTableColumn('parent_id', 'int NOT NULL default 0'))) {
$content[] = 'Could not create parent_id column in images table.</pre>';
return false;
}
}
if (!$db->isTableColumn('url')) {
if (PHPWS_Error::logIfError($db->addTableColumn('url', 'varchar(255) NULL'))) {
$content[] = 'Could not create url column in images table.</pre>';
return false;
}
}
if (!PHPWS_DB::isTable('multimedia')) {
$result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/multimedia.sql');
if (!PHPWS_Error::logIfError($result)) {
$content[] = '--- Multimedia table created successfully.';
} else {
$content[] = '--- Failed to create multimedia table.</pre>';
return false;
}
}
$content[] = '
1.1.0 changes
--------------
+ Fixed authorized check when unpinning folders
+ Images can now be linked to other pages.
+ Resized images can now be linked to their parent image.
+ Clip option moved outside edit_folder permissions when viewing images.
+ Added writable directory check before allowing new folders to be
created.
//.........这里部分代码省略.........
示例10: hms_update
/**
*
* @author theFergus <kevin at tux dot appstate dot edu>
*/
function hms_update(&$content, $currentVersion)
{
$files = array();
switch ($currentVersion) {
case version_compare($currentVersion, '0.1.2', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_2.sql');
if (PEAR::isError($result)) {
return $result;
}
$files[] = 'templates/student/rlc_signup_form_page2.tmp';
PHPWS_Boost::updateFiles($files, 'hms');
$content[] = _('+ RLC application form template');
$content[] = _('+ RLC application table');
case version_compare($currentVersion, '0.1.3', '<'):
$files[] = 'templates/student/rlc_signup_confirmation.tpl';
PHPWS_Boost::updateFiles($files, 'hms');
$content[] = _('+ Complete system for RLC applications');
case version_compare($currentVersion, '0.1.4', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_4.sql');
if (PEAR::isError($result)) {
return $result;
}
$files[] = 'templates/admin/display_final_rlc_assignments.tpl';
$files[] = 'templates/admin/display_rlc_student_detail_form_questions.tpl';
$files[] = 'templates/admin/make_new_rlc_assignments.tpl';
$files[] = 'templates/admin/make_new_rlc_assignments_summary.tpl';
$files[] = 'templates/admin/display_rlc_student_detail.tpl';
$files[] = 'templates/admin/deadlines.tpl';
PHPWS_Boost::updateFiles($files, 'hms');
$content[] = _('+ RLC administration templates');
$content[] = _('+ Deadline for Questionnaire replaced by deadlines for Profile and Application');
$content[] = _('+ Deadline added for editing applications');
$content[] = _('+ Deadline added for submitting RLC applications');
case version_compare($currentVersion, '0.1.5', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_5.sql');
if (PEAR::isError($result)) {
return $result;
}
$files[] = 'templates/admin/deadlines.tpl';
$files[] = 'templates/admin/statistics.tpl';
$files[] = 'templates/student/application_search.tpl';
$files[] = 'templates/student/application_search_pager.tpl';
$files[] = 'templates/student/application_search_results.tpl';
$files[] = 'templates/student/contract.tpl';
$files[] = 'templates/student/student_application.tpl';
$files[] = 'templates/student/student_application_combined.tpl';
$files[] = 'templates/student/student_application_redo.tpl';
PHPWS_Boost::updateFiles($files, 'hms');
$content[] = _('+ Fixed RLC deadline bug in deadlines.tpl');
$content[] = _('+ Added Number of People Assigned');
$content[] = _('+ Added Number of Applications Received');
$content[] = _('+ Added Number of Learning Community Applications Received');
$content[] = _('+ Refactored questionnaire references to application');
$content[] = _('+ Added the contract verbage for when a student first logs in');
$content[] = _('+ Completed Housing applications now go straight into the RLC application if the student said they were interested');
$content[] = _('+ Added link to allow students to go to the RLC application on first login as soon as they complete an application');
$content[] = _('+ Added link to the pdf of the contract for students that want to print it out');
case version_compare($currentVersion, '0.1.6', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_6.sql');
if (PEAR::isError($result)) {
return $result;
}
$files[] = 'templates/admin/maintenance.tpl';
$files[] = 'templates/misc/login.tpl';
PHPWS_Boost::updateFiles($files, 'hms');
$content[] = _('+ Modifying permissions for RLC admins to approve members and assign to rooms');
$content[] = _('+ Added verbage for students to see before they login');
case version_compare($currentVersion, '0.1.7', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_7.sql');
if (PEAR::isError($result)) {
return $result;
}
$files[] = 'templates/admin/make_new_rlc_assignments_summary.tpl';
$files[] = 'templates/admin/rlc_assignments_page.tpl';
$files[] = 'templates/admin/add_floor.tpl';
$files[] = 'templates/admin/display_room_data.tpl';
$files[] = 'templates/admin/display_hall_data.tpl';
$files[] = 'templates/admin/get_hall_floor_room.tpl';
PHPWS_Boost::updateFiles($files, 'hms');
$content[] = '+ Removed capacity_per_room';
$content[] = '+ Added bedrooms_per_room';
$content[] = '+ Added beds_per_bedroom';
$content[] = '+ Added list of existing halls when adding new halls';
$content[] = '+ Room assignments working - assignments now by bed instead of room';
case version_compare($currentVersion, '0.1.8', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_8.sql');
if (PEAR::isError($result)) {
return $result;
}
$files[] = 'templates/admin/display_learning_community_data.tpl';
//.........这里部分代码省略.........
示例11: intern_update
/**
*
* @author Micah Carter <mcarter at tux dot appstate dot edu>
*
*/
function intern_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '0.0.2', '<'):
$files = array();
$files[] = 'templates/add_system.tpl';
PHPWS_Boost::updateFiles($files, 'intern');
case version_compare($currentVersion, '0.0.3', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_03.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.4', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_04.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.6', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_06.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.7', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_07.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.8', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_08.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.9', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_09.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.10', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_10.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.11', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_11.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.12', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_12.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.13', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_13.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.14', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_14.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.15', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_15.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.16', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_16.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.17', '<'):
PHPWS_Core::initModClass('users', 'Permission.php');
Users_Permission::registerPermissions('intern', $content);
case version_compare($currentVersion, '0.0.18', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/intern/boost/updates/update_0_0_18.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.0.19', '<'):
//.........这里部分代码省略.........
示例12: analytics_update
/**
* Description
* @author Jeff Tickle <jtickle at tux dot appstate dot edu>
*/
function analytics_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.0.1', '<'):
$db = new PHPWS_DB('analytics_tracker');
$result = $db->addTableColumn('disable_if_logged', 'int NOT NULL default 0');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to add disable_if_logged column to analytics_tracker table.';
return false;
}
$files = array('templates/edit.tpl');
if (PHPWS_Boost::updateFiles($files, 'analytics')) {
$content[] = '--- Updated templates/edit.tpl';
}
case version_compare($currentVersion, '1.1.0', '<'):
// install.sql has been wrong for awhile, this should fix any discrepancies
$db = new PHPWS_DB('analytics_tracker');
if (!$db->isTableColumn('disable_if_logged')) {
$result = $db->addTableColumn('disable_if_logged', 'int NOT NULL default 0');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to add disable_if_logged column to analytics_tracker table.';
return false;
}
$content[] = '--- Added disable_if_logged option to database';
}
// Load new schema
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/analytics/boost/update/1.1.0.sql');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to import updated schema for version 1.1.0.';
return false;
}
$content[] = '--- Updated Analytics schema to 1.1.0';
// Move Google Analytics data to its own table
$db = new PHPWS_DB('analytics_tracker');
$db->addColumn('id');
$db->addColumn('account');
$db->addWhere('type', 'GoogleAnalyticsTracker');
$result = $db->select();
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to select Google Analytics tracker from analytics_tracker table.';
return false;
}
foreach ($result as $row) {
$db = new PHPWS_DB('analytics_tracker_google');
$db->addValue('id', $row['id']);
// Adding UA- into the account identifier to reduce confusion
$db->addValue('account', 'UA-' . $row['account']);
$db->insert(false);
$content[] = "--- Migrated Google Analytics configuration for account UA-{$row['account']}";
}
$db = new PHPWS_DB('analytics_tracker');
$result = $db->dropTableColumn('account');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to remove account column from analytics_tracker table.';
return false;
}
$content[] = '--- Completed migration to Analytics 1.1.0 schema';
case version_compare($currentVersion, '1.1.1', '<'):
$content[] = <<<EOF
<pre>Version 1.1.1
-------------------
+ Piwik fix.
+ Fixed uninstall script
</pre>
EOF;
}
return true;
}