public function actionInit()
    {
        $module = \jacmoe\mdpages\Module::getInstance();

        if(is_dir(Yii::getAlias($module->pages_directory))) {
            $this->stdout("Content directory already cloned - terminating.\n", Console::FG_GREEN);
            return self::EXIT_CODE_ERROR;
        }

        if (!$this->acquireMutex()) {
            $this->stderr("Execution terminated: command is already running.\n", Console::FG_RED);
            return self::EXIT_CODE_ERROR;
        }

        $result = Shell::execute('(cd {projectRoot}; {binPath} clone {repository} content)', [
            '{binPath}' => 'git',
            '{projectRoot}' => Yii::getAlias($module->root_directory),
            '{repository}' => $module->repository_url,
            ]);

        $files = FileHelper::findFiles(Yii::getAlias('@pages'), [
            'only' => ['*' . $module->page_extension],
        ]);

        $this->updateDB($files);

        $this->createImageSymlink();

        $this->releaseMutex();
        return self::EXIT_CODE_NORMAL;
    }
public function actionInit()
    {
        $module = \jacmoe\mdpages\Module::getInstance();

        if(is_dir(Yii::getAlias($module->pages_directory))) {
            $this->stdout("Content directory already cloned - terminating.\n", Console::FG_GREEN);
            return self::EXIT_CODE_ERROR;
        }

        if (!$this->acquireMutex()) {
            $this->stderr("Execution terminated: command is already running.\n", Console::FG_RED);
            return self::EXIT_CODE_ERROR;
        }

        $result = Shell::execute('(cd {projectRoot}; {binPath} clone {repository} content)', [
            '{binPath}' => 'git',
            '{projectRoot}' => Yii::getAlias($module->root_directory),
            '{repository}' => $module->repository_url,
            ]);

        $files = FileHelper::findFiles(Yii::getAlias('@pages'), [
            'only' => ['*' . $module->page_extension],
        ]);

        $this->updateDB($files);

        $this->createImageSymlink();

        $this->releaseMutex();
        return self::EXIT_CODE_NORMAL;
    }
public function actionInit ( ) { $ module = \ jacmoe \ mdpages \ Module :: getInstance ( ) ; if ( is_dir ( Yii :: getAlias ( $ module -> pages_directory ) ) ) { $ this -> stdout ( "Content directory already cloned - terminating.\n" , Console :: FG_GREEN ) ; return self :: EXIT_CODE_ERROR ; } if ( ! $ this -> acquireMutex ( ) ) { $ this -> stderr ( "Execution terminated: command is already running.\n" , Console :: FG_RED ) ; return self :: EXIT_CODE_ERROR ; } $ result = Shell :: execute ( '(cd {projectRoot}; {binPath} clone {repository} content)' , [ '{binPath}' => 'git' , '{projectRoot}' => Yii :: getAlias ( $ module -> root_directory ) , '{repository}' => $ module -> repository_url , ] ) ; $ files = FileHelper :: findFiles ( Yii :: getAlias ( '@pages' ) , [ 'only' => [ '*' . $ module -> page_extension ] , ] ) ; $ this -> updateDB ( $ files ) ; $ this -> createImageSymlink ( ) ; $ this -> releaseMutex ( ) ; return self :: EXIT_CODE_NORMAL ; }
Initializes the content directory and Flywheel database from scratch
@return integer exit code (success or error)
Initializes the content directory and Flywheel database from scratch