Example #1
0
 /**
  * Method create dump of database
  *
  * @param null $module
  * @param string $name
  * @param string $whitelist
  * @param string $blacklist
  * @return string
  * @throws ZFCToolException
  */
 public function create($module = null, $name = '', $whitelist = "", $blacklist = "")
 {
     $database = new Database($this->db, $this->getOptions($whitelist, $blacklist));
     if ($dump = $database->getDump()) {
         $path = $this->getDumpsDirectoryPath($module);
         if (!$name) {
             list(, $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 EmptyDumpException("Can not get database dump!");
     }
 }