Example #1
0
 /**
  * Copy sql script
  * @param string $fromFile
  * @param string $module
  * @return boolean
  */
 protected function copySqlScript($fromFile, $module)
 {
     $baseName = $this->getSqlScriptBaseName($fromFile, $module);
     if ($this->sqlScriptExists($baseName)) {
         return true;
     }
     $toFile = $this->dbDir . '/' . $this->getNextSqlNum() . '-' . $baseName;
     if (!copy($fromFile, $toFile)) {
         $this->io->writeError("Error copying [{$fromFile}]");
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Set the security.salt value in the application's config file.
  *
  * @param string $dir The application's root directory.
  * @param Composer\IO\IOInterface $io IO interface to write to console.
  * @return void
  */
 public static function setSecuritySalt($dir, $io)
 {
     $config = $dir . '/config/app.php';
     $content = file_get_contents($config);
     $newKey = hash('sha256', $dir . php_uname() . microtime(true));
     $content = str_replace('__SALT__', $newKey, $content, $count);
     if ($count == 0) {
         $io->write('No Security.salt placeholder to replace.');
         return;
     }
     $result = file_put_contents($config, $content);
     if ($result) {
         $io->write('Updated Security.salt value in config/app.php');
         return;
     }
     $io->write('Unable to update Security.salt value.');
 }
Example #3
0
 /**
  * Set the security.salt value in the application's config file.
  *
  * @param string $dir The application's root directory.
  * @param Composer\IO\IOInterface $io IO interface to write to console.
  * @return void
  */
 public static function setSecuritySalt($dir, $io)
 {
     $config = $dir . '/app/Config/core.php';
     $content = file_get_contents($config);
     $newKey = hash('sha256', $dir . php_uname() . microtime(true));
     $newKeyCipherSeed = str_pad(time(), 29, mt_rand(), STR_PAD_BOTH);
     $content = str_replace('DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi', $newKey, $content, $count);
     $content = str_replace('76859309657453542496749683645', $newKeyCipherSeed, $content, $count);
     if ($count == 0) {
         $io->write('No Security.salt placeholder to replace.');
         return;
     }
     $result = file_put_contents($config, $content);
     if ($result) {
         $io->write('Updated Security.salt value in app/Config/core.php');
         return;
     }
     $io->write('Unable to update Security.salt value.');
 }