当前位置: 首页>>代码示例>>PHP>>正文


PHP AEFactory::getDatabase方法代码示例

本文整理汇总了PHP中AEFactory::getDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP AEFactory::getDatabase方法的具体用法?PHP AEFactory::getDatabase怎么用?PHP AEFactory::getDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AEFactory的用法示例。


在下文中一共展示了AEFactory::getDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepare

 protected function _prepare()
 {
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Processing parameters");
     // Get the DB connection parameters
     if (is_array($this->_parametersArray)) {
         $driver = array_key_exists('driver', $this->_parametersArray) ? $this->_parametersArray['driver'] : 'mysql';
         $host = array_key_exists('host', $this->_parametersArray) ? $this->_parametersArray['host'] : '';
         $port = array_key_exists('port', $this->_parametersArray) ? $this->_parametersArray['port'] : '';
         $username = array_key_exists('username', $this->_parametersArray) ? $this->_parametersArray['username'] : '';
         $username = array_key_exists('user', $this->_parametersArray) ? $this->_parametersArray['user'] : $username;
         $password = array_key_exists('password', $this->_parametersArray) ? $this->_parametersArray['password'] : '';
         $database = array_key_exists('database', $this->_parametersArray) ? $this->_parametersArray['database'] : '';
         $prefix = array_key_exists('prefix', $this->_parametersArray) ? $this->_parametersArray['prefix'] : '';
     }
     $options = array('driver' => $driver, 'host' => $host . ($port != '' ? ':' . $port : ''), 'user' => $username, 'password' => $password, 'database' => $database, 'prefix' => is_null($prefix) ? '' : $prefix);
     $db = AEFactory::getDatabase($options);
     $driverType = $db->getDriverType();
     $className = 'AEDumpNative' . ucfirst($driverType);
     // Check if we have a native dump driver
     if (!class_exists($className, true)) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Native database dump engine {$className} not found; trying Reverse Engineering instead");
         // Native driver nor found, I will try falling back to reverse engineering
         $className = 'AEDumpReverse' . ucfirst($driverType);
     }
     if (!class_exists($className, true)) {
         $this->setState('error', 'Akeeba Engine does not have a native dump engine for ' . $driverType . ' databases');
     } else {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Instanciating new native database dump engine {$className}");
         $this->_engine = new $className();
         $this->_engine->setup($this->_parametersArray);
         $this->_engine->callStage('_prepare');
         $this->setState($this->_engine->getState(), $this->_engine->getError());
     }
 }
开发者ID:01J,项目名称:topm,代码行数:34,代码来源:native.php

示例2: loadConfig

 private static function loadConfig()
 {
     if (defined('JVERSION')) {
         $j16 = version_compare(JVERSION, '1.6.0', 'ge');
     } else {
         $j16 = false;
     }
     $db =& AEFactory::getDatabase();
     if (!$j16) {
         $sql = "SELECT " . $db->nameQuote('params') . " FROM " . $db->nameQuote('#__components') . " WHERE (" . $db->nameQuote('link') . " = " . $db->Quote('option=com_akeeba') . ") AND (" . $db->nameQuote('parent') . " = " . $db->Quote('0') . ")";
         $db->setQuery($sql);
         $config_ini = $db->loadResult();
     } else {
         $config_ini = null;
     }
     if ($db->getErrorNum() || is_null($config_ini)) {
         // Maybe it's Joomla! 1.6?
         $sql = "SELECT " . $db->nameQuote('params') . " FROM " . $db->nameQuote('#__extensions') . " WHERE (" . $db->nameQuote('type') . ' = ' . $db->Quote('component') . ') AND (' . $db->nameQuote('element') . " = " . $db->Quote('com_akeeba') . ")";
         $db->setQuery($sql);
         $config_ini = $db->loadResult();
         // OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right!
         $config_ini = json_decode($config_ini, true);
         return $config_ini;
     }
     return AEUtilINI::parse_ini_file($config_ini, false, true);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:comconfig.php

示例3: foreach

 public function &getExtraSQL($root)
 {
     $empty = '';
     if ($root != '[SITEDB]') {
         return $empty;
     }
     $sql = '';
     $db = AEFactory::getDatabase();
     $this->getFilters(null);
     // Forcibly reload the filter data
     // Loop all components and add SQL statements
     if (!empty($this->filter_data)) {
         foreach ($this->filter_data as $type => $items) {
             if (!empty($items)) {
                 // Make sure that DB only backups get the correct prefix
                 $configuration = AEFactory::getConfiguration();
                 $abstract = AEUtilScripting::getScriptingParameter('db.abstractnames', 1);
                 if ($abstract) {
                     $prefix = '#__';
                 } else {
                     $prefix = $db->getPrefix();
                 }
                 foreach ($items as $item) {
                     $client = $type == 'frontend' ? 0 : 1;
                     $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'modules_menu') . ' WHERE ' . $db->quoteName('moduleid') . ' IN (' . 'SELECT ' . $db->quoteName('id') . ' FROM ' . $db->quoteName($prefix . 'modules') . ' WHERE ' . '(' . $db->quoteName('module') . ' = ' . $db->Quote($item) . ')' . ' AND (' . $db->quoteName('client_id') . ' = ' . $db->Quote($client) . ')' . ");\n";
                     $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'modules') . ' WHERE ' . '(' . $db->quoteName('module') . ' = ' . $db->Quote($item) . ')' . ' AND (' . $db->quoteName('client_id') . ' = ' . $db->Quote($client) . ')' . ";\n";
                     $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'extensions') . ' WHERE ' . $db->quoteName('element') . ' = ' . $db->Quote($item) . " AND " . $db->quoteName('type') . ' = ' . $db->Quote('module') . ";\n";
                 }
             }
         }
     }
     return $sql;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:33,代码来源:modules.php

示例4: foreach

 public function &getExtraSQL($root)
 {
     $empty = '';
     if ($root != '[SITEDB]') {
         return $empty;
     }
     $sql = '';
     $db = AEFactory::getDatabase();
     $this->getFilters(null);
     // Forcibly reload the filter data
     // Loop all components and add SQL statements
     if (!empty($this->filter_data)) {
         foreach ($this->filter_data as $type => $items) {
             if (!empty($items)) {
                 // Make sure that DB only backups get the correct prefix
                 $configuration = AEFactory::getConfiguration();
                 $abstract = AEUtilScripting::getScriptingParameter('db.abstractnames', 1);
                 if ($abstract) {
                     $prefix = '#__';
                 } else {
                     $prefix = $db->getPrefix();
                 }
                 foreach ($items as $item) {
                     if (!$this->joomla16) {
                         $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'components') . ' WHERE ' . $db->quoteName('option') . ' = ' . $db->Quote($item) . ";\n";
                     } else {
                         $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'extensions') . ' WHERE ' . $db->quoteName('element') . ' = ' . $db->Quote($item) . " AND " . $db->quoteName('type') . ' = ' . $db->Quote('component') . ";\n";
                     }
                     $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'menu') . ' WHERE ' . $db->quoteName('type') . ' = ' . $db->Quote('component') . ' AND ' . $db->quoteName('link') . ' LIKE ' . $db->Quote('%option=' . $item . '%') . ";\n";
                 }
             }
         }
     }
     return $sql;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:35,代码来源:components.php

示例5: make_listing

 /**
  * Returns a list of the database tables, views, procedures, functions and triggers,
  * along with their filter status in array format, for use in the GUI
  * @return array
  */
 public function make_listing($root)
 {
     // Get database inclusion filters
     $filters =& AEFactory::getFilters();
     $database_list = $filters->getInclusions('db');
     // Load the database object for the selected database
     $config = $database_list[$root];
     $config['user'] = $config['username'];
     $db =& AEFactory::getDatabase($config);
     // Load the table data
     $table_data = $db->getTables();
     // Process filters
     $tables = array();
     if (!empty($table_data)) {
         foreach ($table_data as $table_name => $table_type) {
             $status = array();
             // Add table type
             $status['type'] = $table_type;
             // Check dbobject/all filter (exclude)
             $result = $filters->isFilteredExtended($table_name, $root, 'dbobject', 'all', $byFilter);
             $status['tables'] = !$result ? 0 : ($byFilter == 'tables' ? 1 : 2);
             // Check dbobject/content filter (skip table data)
             $result = $filters->isFilteredExtended($table_name, $root, 'dbobject', 'content', $byFilter);
             $status['tabledata'] = !$result ? 0 : ($byFilter == 'tabledata' ? 1 : 2);
             if ($table_type != 'table') {
                 $status['tabledata'] = 2;
             }
             // We can't filter contents of views, merge tables, black holes, procedures, functions and triggers :)
             $tables[$table_name] = $status;
         }
     }
     return array('tables' => $tables, 'root' => $root);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:38,代码来源:dbef.php

示例6: check

 public function check()
 {
     $db = AEFactory::getDatabase();
     // Can I execute SHOW statements?
     try {
         $result = $db->setQuery('SHOW TABLES')->query();
     } catch (Exception $e) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW TABLES statement");
         $this->setResult(-1);
         throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR'));
     }
     if (!$result) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW TABLES statement");
         $this->setResult(-1);
         throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR'));
     }
     try {
         $result = $db->setQuery('SHOW CREATE TABLE ' . $db->nameQuote('#__ak_profiles'))->query();
     } catch (Exception $e) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW CREATE TABLE statement");
         $this->setResult(-1);
         throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR'));
     }
     if (!$result) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW CREATE TABLE statement");
         $this->setResult(-1);
         throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR'));
     }
     return true;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:30,代码来源:dbpermissions.php

示例7: loadConfig

 private static function loadConfig()
 {
     $db = AEFactory::getDatabase();
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_akeeba'));
     $db->setQuery($sql);
     $config_ini = $db->loadResult();
     // OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right!
     $config_ini = json_decode($config_ini, true);
     if (is_null($config_ini) || empty($config_ini)) {
         $config_ini = array();
     }
     return $config_ini;
 }
开发者ID:01J,项目名称:furcom,代码行数:13,代码来源:comconfig.php

示例8: get_administrator_emails

 /**
  * Returns a list of emails to the Super Administrators
  * @return unknown_type
  */
 public function get_administrator_emails()
 {
     $db =& AEFactory::getDatabase($this->get_platform_database_options());
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $query = 'SELECT u.name, u.email FROM #__users AS u INNER JOIN #__user_usergroup_map AS m ON(m.user_id = u.id) ' . ' WHERE m.group_id = 8 ';
     } else {
         $query = 'SELECT name, email FROM #__users' . ' WHERE usertype = \'Super Administrator\' ';
     }
     $db->setQuery($query);
     $superAdmins =& $db->loadAssocList();
     $mails = array();
     if (!empty($superAdmins)) {
         foreach ($superAdmins as $admin) {
             $mails[] = $admin['email'];
         }
     }
     return $mails;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:22,代码来源:platform.php

示例9: apply_obsolete_quotas

 /**
  * Keeps a maximum number of "obsolete" records
  */
 private function apply_obsolete_quotas()
 {
     $this->setStep('Applying quota limit on obsolete backup records');
     $this->setSubstep('');
     $registry = AEFactory::getConfiguration();
     $limit = $registry->get('akeeba.quota.obsolete_quota', 0);
     $limit = (int) $limit;
     if ($limit <= 0) {
         return;
     }
     $statsTable = AEPlatform::getInstance()->tableNameStats;
     $db = AEFactory::getDatabase(AEPlatform::getInstance()->get_platform_database_options());
     $query = $db->getQuery(true)->select(array($db->qn('id'), $db->qn('backupid'), $db->qn('absolute_path')))->from($db->qn($statsTable))->where($db->qn('status') . ' = ' . $db->q('complete'))->where($db->qn('filesexist') . '=' . $db->q('0'))->order($db->qn('id') . ' DESC');
     $db->setQuery($query, $limit, 100000);
     $records = $db->loadAssocList();
     if (empty($records)) {
         return;
     }
     $array = array();
     // Delete backup-specific log files if they exist and add the IDs of the records to delete in the $array
     foreach ($records as $stat) {
         $array[] = $stat['id'];
         // We can't delete logs if there is no backup ID in the record
         if (!isset($stat['backupid']) || empty($stat['backupid'])) {
             continue;
         }
         $logFileName = 'akeeba.' . $stat['tag'] . '.' . $stat['backupid'] . '.log';
         $logPath = dirname($stat['absolute_path']) . '/' . $logFileName;
         @unlink($logPath);
     }
     $ids = array();
     foreach ($array as $id) {
         $ids[] = $db->q($id);
     }
     $ids = implode(',', $ids);
     $query = $db->getQuery(true)->delete($db->qn($statsTable))->where($db->qn('id') . " IN ({$ids})");
     $db->setQuery($query);
     $db->query();
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:42,代码来源:finalization.php

示例10: switch

 public static function &get($tag = null)
 {
     $storage_filename = self::get_storage_filename($tag);
     $ret = false;
     switch (self::getStorageEngine()) {
         case 'file':
             $rawdata = @file_get_contents($storage_filename);
             if ($rawdata === false) {
                 return $ret;
             }
             if (strpos($rawdata, "\n") === false) {
                 return $ret;
             }
             list($header, $data) = explode("\n", $rawdata);
             unset($rawdata);
             unset($header);
             break;
         case 'db':
             $db = AEFactory::getDatabase();
             $sql = 'SELECT `data` FROM `#__ak_storage` WHERE `tag` = ' . $db->Quote($storage_filename);
             $db->setQuery($sql);
             $data = $db->loadResult();
             break;
     }
     $ret = self::decode($data);
     unset($data);
     return $ret;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:28,代码来源:tempvars.php

示例11: is_null

 /**
  * Return an instance of AEAbstractDriver
  *
  * @return AEAbstractDriver
  */
 protected function &getDB()
 {
     $host = $this->host . ($this->port != '' ? ':' . $this->port : '');
     $user = $this->username;
     $password = $this->password;
     $driver = $this->driver;
     $database = $this->database;
     $prefix = is_null($this->prefix) ? '' : $this->prefix;
     $options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
     $db = AEFactory::getDatabase($options);
     if ($error = $db->getError()) {
         $this->setError(__CLASS__ . ' :: Database Error: ' . $error);
         $false = false;
         return $false;
     }
     if ($db->getErrorNum() > 0) {
         $error = $db->getErrorMsg();
         $this->setError(__CLASS__ . ' :: Database Error: ' . $error);
         $false = false;
         return $false;
     }
     return $db;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:28,代码来源:dump.php

示例12: execute


//.........这里部分代码省略.........
                require_once $factoryPath;
            } catch (Exception $e) {
                echo "ERROR!\n";
                echo "Backup engine returned an error. Technical information:\n";
                echo "Error message:\n\n";
                echo $e->getMessage() . "\n\n";
                echo "Path to " . basename(__FILE__) . ":" . __DIR__ . "\n";
                echo "Path to factory file: {$factoryPath}\n";
                die("\n");
            }
        }
        // Forced CLI mode settings
        define('AKEEBA_PROFILE', $profile);
        define('AKEEBA_BACKUP_ORIGIN', 'cli');
        // Force loading CLI-mode translation class
        $dummy = new AEUtilTranslate();
        // Load the profile
        AEPlatform::getInstance()->load_configuration($profile);
        // Reset Kettenrad and its storage
        AECoreKettenrad::reset(array('maxrun' => 0));
        AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN);
        // Setup
        $kettenrad = AEFactory::getKettenrad();
        $options = array('description' => $description, 'comment' => '');
        if (!empty($overrides)) {
            AEPlatform::getInstance()->configOverrides = $overrides;
        }
        $kettenrad->setup($options);
        // Dummy array so that the loop iterates once
        $array = array('HasRun' => 0, 'Error' => '');
        $warnings_flag = false;
        while ($array['HasRun'] != 1 && empty($array['Error'])) {
            // Recycle the database conenction to minimise problems with database timeouts
            $db = AEFactory::getDatabase();
            $db->close();
            $db->open();
            AEUtilLogger::openLog(AKEEBA_BACKUP_ORIGIN);
            AEUtilLogger::WriteLog(true, '');
            // Apply overrides in the command line
            if (!empty($overrides)) {
                $config = AEFactory::getConfiguration();
                foreach ($overrides as $key => $value) {
                    $config->set($key, $value);
                }
            }
            // Apply engine optimization overrides
            $config = AEFactory::getConfiguration();
            $config->set('akeeba.tuning.min_exec_time', 0);
            $config->set('akeeba.tuning.nobreak.beforelargefile', 1);
            $config->set('akeeba.tuning.nobreak.afterlargefile', 1);
            $config->set('akeeba.tuning.nobreak.proactive', 1);
            $config->set('akeeba.tuning.nobreak.finalization', 1);
            $config->set('akeeba.tuning.settimelimit', 0);
            $config->set('akeeba.tuning.nobreak.domains', 0);
            $kettenrad->tick();
            AEFactory::getTimer()->resetTime();
            $array = $kettenrad->getStatusArray();
            AEUtilLogger::closeLog();
            $time = date('Y-m-d H:i:s \\G\\M\\TO (T)');
            $memusage = $this->memUsage();
            $warnings = "no warnings issued (good)";
            $stepWarnings = false;
            if (!empty($array['Warnings'])) {
                $warnings_flag = true;
                $warnings = "POTENTIAL PROBLEMS DETECTED; " . count($array['Warnings']) . " warnings issued (see below).\n";
                foreach ($array['Warnings'] as $line) {
开发者ID:sillysachin,项目名称:teamtogether,代码行数:67,代码来源:akeeba-backup.php

示例13: switch

 public static function &get($tag = null)
 {
     $storage_filename = self::get_storage_filename($tag);
     $ret = false;
     switch (self::getStorageEngine()) {
         case 'file':
             $rawdata = @file_get_contents($storage_filename);
             if ($rawdata === false) {
                 return $ret;
             }
             if (strpos($rawdata, "\n") === false) {
                 return $ret;
             }
             list($header, $data) = explode("\n", $rawdata);
             unset($rawdata);
             unset($header);
             break;
         case 'db':
             $db = AEFactory::getDatabase();
             $sql = $db->getQuery(true)->select($db->qn('data'))->from($db->qn('#__ak_storage'))->where($db->qn('tag') . ' = ' . $db->q($storage_filename));
             $db->setQuery($sql);
             $data = $db->loadResult();
             break;
     }
     $ret = self::decode($data);
     unset($data);
     return $ret;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:28,代码来源:tempvars.php

示例14: save_filters

 /**
  * Saves the nested filter data array $filter_data to the database
  * @param	array	$filter_data	The filter data to save
  * @return	bool	True on success
  */
 public function save_filters(&$filter_data)
 {
     $profile_id = $this->get_active_profile();
     $db = AEFactory::getDatabase($this->get_platform_database_options());
     $sql = $db->getQuery(true)->update($db->qn($this->tableNameProfiles))->set($db->qn('filters') . '=' . $db->q(serialize($filter_data)))->where($db->qn('id') . ' = ' . $db->q($profile_id));
     $db->setQuery($sql);
     $db->query();
     $errors = $db->getError();
     return empty($errors);
 }
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:15,代码来源:abstract.php

示例15: apply_obsolete_quotas

 /**
  * Keeps a maximum number of "obsolete" records
  */
 private function apply_obsolete_quotas()
 {
     $this->setStep('Applying quota limit on obsolete backup records');
     $this->setSubstep('');
     $registry =& AEFactory::getConfiguration();
     $limit = $registry->get('akeeba.quota.obsolete_quota', 0);
     $limit = (int) $limit;
     if ($limit <= 0) {
         return;
     }
     $db =& AEFactory::getDatabase(AEPlatform::getInstance()->get_platform_database_options());
     $query = 'SELECT `id` FROM #__ak_stats WHERE `status` = \'complete\' AND `filesexist` = 0 ORDER BY `id` DESC LIMIT ' . $limit . ',100000';
     $db->setQuery($query);
     $array = $db->loadResultArray();
     if (empty($array)) {
         return;
     }
     $ids = implode(',', $array);
     $query = "DELETE FROM #__ak_stats WHERE " . $db->nameQuote('id') . " IN ({$ids})";
     $db->setQuery($query);
     $db->query();
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:25,代码来源:finalization.php


注:本文中的AEFactory::getDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。