本文整理汇总了PHP中PHPWS_DB::import方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::import方法的具体用法?PHP PHPWS_DB::import怎么用?PHP PHPWS_DB::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::import方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importSQL
public function importSQL($file)
{
require_once 'File.php';
if (!is_file($file)) {
return PHPWS_Error::get(BOOST_ERR_NO_INSTALLSQL, 'boost', 'importSQL', 'File: ' . $file);
}
$sql = File::readAll($file);
$db = new PHPWS_DB();
$result = $db->import($sql);
return $result;
}
示例2: users_update
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function users_update(&$content, $currentVersion)
{
$home_dir = PHPWS_Boost::getHomeDir();
switch ($currentVersion) {
case version_compare($currentVersion, '2.2.0', '<'):
$content[] = 'This package does not update versions under 2.2.0';
return false;
case version_compare($currentVersion, '2.2.1', '<'):
$content[] = '+ Fixed a bug causing conflicts between user and group permissions.';
case version_compare($currentVersion, '2.2.2', '<'):
$content[] = '+ Set username to the same character size in both users table and user_authorization.';
$content[] = '+ Fixed typo causing branch installation failure on Postgresql.';
case version_compare($currentVersion, '2.3.0', '<'):
$content[] = '<pre>
2.3.0 changes
------------------------
+ Added translate function calls in classes and my_page.php
+ my_page hides translation option if language defines disable selection
+ Added a unrestricted only parameter to Current_User\'s allow and
authorize functions
+ Dropped references from some constructors
+ Added error check to setPermissions function: won\'t accept empty
group id
+ Changed id default to zero.
+ Removed unneeded function parameter on getGroups
</pre>
';
case version_compare($currentVersion, '2.3.1', '<'):
$content[] = '<pre>';
$files = array('templates/my_page/user_setting.tpl');
userUpdateFiles($files, $content);
$content[] = '
2.3.1 changes
------------------------
+ Added ability for user to set editor preferences
</pre>
';
case version_compare($currentVersion, '2.3.2', '<'):
$content[] = '<pre>2.3.2 changes';
$files = array('img/users.png', 'templates/user_main.tpl');
userUpdateFiles($files, $content);
$content[] = '+ Added error check to login.
+ Changed user control panel icon.
+ Fixed template typo that broke IE login.
+ Removed fake French translation (delete mod/users/locale/fr_FR/ directory
+ Permissions are now ordered alphabetically.
+ isUser will now always return false if passed a zero id.
+ Added new function requireLogin that forwards a user to the login
screen
</pre>';
case version_compare($currentVersion, '2.4.0', '<'):
if (!PHPWS_DB::isTable('users_pw_reset')) {
$new_table = 'CREATE TABLE users_pw_reset (
user_id INT NOT NULL default 0,
authhash CHAR( 32 ) NOT NULL default 0,
timeout INT NOT NULL default 0,
);';
if (!PHPWS_DB::import($new_table)) {
$content[] = 'Unable to create users_pw_reset table.';
return false;
} else {
$content[] = 'Created new table: users_pw_reset';
}
}
$files = array('templates/forms/reset_password.tpl', 'templates/forms/forgot.tpl', 'conf/config.php', 'templates/usermenus/top.tpl', 'templates/forms/settings.tpl', 'templates/my_page/user_setting.tpl');
$content[] = '<pre>';
userUpdatefiles($files, $content);
if (!PHPWS_Boost::inBranch()) {
$content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_0.txt');
}
$content[] = '</pre>';
case version_compare($currentVersion, '2.4.1', '<'):
$content[] = '<pre>';
$files = array('conf/languages.php');
userUpdateFiles($files, $content);
$content[] = '
2.4.1 changes
------------------------
+ Default item id on permission check functions is now zero instead of
null. This will make checking permissions a little easier on new items.
+ Bug #1690657 - Changed group select js property to onclick instead
of onchange. Thanks singletrack.
+ Changed the language abbreviation for Danish
</pre>
';
case version_compare($currentVersion, '2.4.2', '<'):
$content[] = '<pre>';
$files = array('templates/usermenus/Default.tpl');
userUpdateFiles($files, $content);
if (!PHPWS_Boost::inBranch()) {
$content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_2.txt');
}
$content[] = '</pre>';
case version_compare($currentVersion, '2.4.3', '<'):
$content[] = '<pre>';
if (!PHPWS_Boost::inBranch()) {
//.........这里部分代码省略.........
示例3: importFile
/**
* Imports a SQL dump file into the database.
* This function can not be called statically.
*/
public static function importFile($filename, $report_errors = true)
{
if (!is_file($filename)) {
return PHPWS_Error::get(PHPWS_FILE_NOT_FOUND, 'core', 'PHPWS_DB::importFile');
}
$data = file_get_contents($filename);
return PHPWS_DB::import($data, $report_errors);
}
示例4: createEventTable
/**
* Creates an event and repeat table for the schedule
*/
public function createEventTable()
{
$table = $this->getEventTable();
$recurr = $this->getRecurrenceTable();
if (empty($table) || empty($recurr)) {
return PHPWS_Error::get(CAL_CANNOT_MAKE_EVENT_TABLE, 'calendar', 'Calendar_Schedule::createEventTable');
}
$template['TABLE'] = $table;
$template['RECURR_TABLE'] = $recurr;
$template['INDEX_NAME'] = str_replace('_', '', $table) . '_idx';
$template['RECURR_INDEX_NAME'] = str_replace('_', '', $recurr) . '_idx';
$file = PHPWS_SOURCE_DIR . 'mod/calendar/inc/event_table.sql';
if (!is_file($file)) {
return PHPWS_Error::get(PHPWS_FILE_NOT_FOUND, 'calendar', 'Calendar_Schedule::createEventTable', $file);
}
$query = PHPWS_Template::process($template, 'calendar', $file, true);
return PHPWS_DB::import($query);
}