コード例 #1
0
ファイル: Manager.php プロジェクト: uglide/zfcore-transition
 /**
  * Method create dump of database
  *
  * @param null $module
  * @param string $name
  * @param string $whitelist
  * @param string $blacklist
  * @return string
  * @throws Zend_Exception
  */
 public function create($module = null, $name = '', $whitelist = "", $blacklist = "")
 {
     $database = new Core_Db_Database($this->getOptions($whitelist, $blacklist));
     if ($dump = $database->getDump()) {
         $path = $this->getDumpsDirectoryPath($module);
         if (!$name) {
             list($sec, $msec) = explode(".", microtime(true));
             $name = date('Ymd_His_') . substr($msec, 0, 2) . '.sql';
         }
         file_put_contents($path . DIRECTORY_SEPARATOR . $name, $dump);
         return $name;
     } else {
         throw new Zend_Exception("Can not get database dump!");
     }
 }