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


PHP base::get_dbname方法代码示例

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


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

示例1: dump_base

 protected function dump_base(base $base, InputInterface $input, OutputInterface $output)
 {
     $date_obj = new DateTime();
     $filename = sprintf('%s%s_%s.sql', p4string::addEndSlash($input->getArgument('directory')), $base->get_dbname(), $date_obj->format('Y_m_d_H_i_s'));
     $command = sprintf('mysqldump %s %s %s %s %s %s --default-character-set=utf8', '--host=' . escapeshellarg($base->get_host()), '--port=' . escapeshellarg($base->get_port()), '--user=' . escapeshellarg($base->get_user()), '--password=' . escapeshellarg($base->get_passwd()), '--databases', escapeshellarg($base->get_dbname()));
     if ($input->getOption('gzip')) {
         $filename .= '.gz';
         $command .= ' | gzip -9';
     } elseif ($input->getOption('bzip')) {
         $filename .= '.bz2';
         $command .= ' | bzip2 -9';
     }
     $output->write(sprintf('Generating <info>%s</info> ... ', $filename));
     $command .= ' > ' . escapeshellarg($filename);
     $process = new Process($command);
     $process->setTimeout((int) $input->getOption('timeout'));
     $process->run();
     if (!$process->isSuccessful()) {
         $output->writeln('<error>Failed</error>');
         return 1;
     }
     if (file_exists($filename) && filesize($filename) > 0) {
         $output->writeln('OK');
         return 0;
     } else {
         $output->writeln('<error>Failed</error>');
         return 1;
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:29,代码来源:systemBackupDB.php

示例2: upgradeDatabase

 public function upgradeDatabase(\base $base, $applyPatches)
 {
     $recommends = [];
     $allTables = [];
     $schema = $base->get_schema();
     foreach ($schema->tables->table as $table) {
         $allTables[(string) $table['name']] = $table;
     }
     $foundTables = $this->connection->fetchAll("SHOW TABLE STATUS");
     foreach ($foundTables as $foundTable) {
         $tableName = $foundTable["Name"];
         if (isset($allTables[$tableName])) {
             $engine = strtolower(trim($allTables[$tableName]->engine));
             $ref_engine = strtolower($foundTable['Engine']);
             if ($engine != $ref_engine && in_array($engine, ['innodb', 'myisam'])) {
                 $recommends = $this->alterTableEngine($tableName, $engine, $recommends);
             }
             $ret = $this->upgradeTable($allTables[$tableName]);
             $recommends = array_merge($recommends, $ret);
             unset($allTables[$tableName]);
         } elseif (!in_array($tableName, self::$ormTables)) {
             $recommends[] = ['message' => 'Une table pourrait etre supprime', 'sql' => 'DROP TABLE ' . $base->get_dbname() . '.`' . $tableName . '`;'];
         }
     }
     foreach ($allTables as $tableName => $table) {
         $this->createTable($table);
     }
     $current_version = $base->get_version();
     if ($applyPatches) {
         $this->applyPatches($base, $current_version, $this->app['phraseanet.version']->getNumber(), false, $this->app);
     }
     return $recommends;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:33,代码来源:DatabaseMaintenanceService.php


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