Inheritance: extends yii\helpers\FileHelper
Beispiel #1
0
 /**
  * Clear asstes directories
  */
 public function actionFlushAssets()
 {
     $paths = ArrayHelper::getValue(\Yii::$app->cms->tmpFolderScheme, 'assets');
     $this->stdout("Clear assets directories\n", Console::FG_YELLOW);
     if ($paths) {
         foreach ($paths as $path) {
             $realPath = \Yii::getAlias($path);
             $this->stdout("\tClear asset directory: {$realPath}\n");
             FileHelper::removeDirectory(\Yii::getAlias($path));
             FileHelper::createDirectory(\Yii::getAlias($path));
         }
     }
 }
Beispiel #2
0
 /**
  * @return bool
  */
 public function generateTmpConsoleConfig()
 {
     $configs = FileHelper::findExtensionsFiles(['/config/main-console.php']);
     $configs = array_unique(array_merge([\Yii::getAlias('@skeeks/cms/config/main-console.php')], $configs));
     $result = [];
     foreach ($configs as $filePath) {
         $fileData = (array) (include $filePath);
         $result = \yii\helpers\ArrayHelper::merge($result, $fileData);
     }
     if (!file_exists(dirname(TMP_CONSOLE_CONFIG_FILE_EXTENSIONS))) {
         mkdir(dirname(TMP_CONSOLE_CONFIG_FILE_EXTENSIONS), 0777, true);
     }
     $string = var_export($result, true);
     file_put_contents(TMP_CONSOLE_CONFIG_FILE_EXTENSIONS, "<?php\n\nreturn {$string};\n");
     // invalidate opcache of extensions.php if exists
     if (function_exists('opcache_invalidate')) {
         opcache_invalidate(TMP_CONSOLE_CONFIG_FILE_EXTENSIONS, true);
     }
     return file_exists(TMP_CONSOLE_CONFIG_FILE_EXTENSIONS);
 }
Beispiel #3
0
 /**
  * Путь к файлу в этом расширении
  *
  * @param $filePath
  * @return null|string
  */
 public function getFilePath($filePath)
 {
     $composerFiles = [];
     foreach ($this->alias as $name => $path) {
         $composerFiles[] = $path . '/' . $filePath;
     }
     return FileHelper::getFirstExistingFileArray($composerFiles);
 }
Beispiel #4
0
 function setWritable($root, $paths)
 {
     foreach ($paths as $writable) {
         if (!is_dir("{$root}/{$writable}")) {
             echo "      create dir and chmod 0777 {$writable}\n";
             FileHelper::createDirectory("{$root}/{$writable}", 0777);
         } else {
             echo "      chmod 0777 {$writable}\n";
             @chmod("{$root}/{$writable}", 0777);
         }
     }
 }
Beispiel #5
0
<br />
                            Dsn: <?php 
echo \Yii::$app->db->dsn;
?>
                        </div>


                        <div style="text-align: center;">
                            <button class="btn btn-success btn-lg" onclick="sx.DbRestore.execute(); return false;">
                                <i class="glyphicon glyphicon-play"></i>
                                <?php 
echo \Yii::t('app', 'Start a new installation');
?>
                            </button>
                            <?php 
if ($files = \skeeks\cms\helpers\FileHelper::findFiles(\Yii::$app->dbDump->backupDir)) {
    ?>
                                <hr />
                                <h2><?php 
    echo \Yii::t('app', 'Install from a backup file');
    ?>
</h2>
                                <?php 
    foreach ($files as $file) {
        ?>
                                    <?php 
        $fileObj = new \skeeks\sx\File($file);
        ?>
                                    <br />
                                    <button class="btn btn-success" onclick="sx.DbRestore.execute('<?php 
        echo $fileObj->getBaseName();