<commit_before><?php

namespace luya\console\commands;

use Yii;
use yii\helpers\FileHelper;
use yii\helpers\Console;

/**
 * Health/Status informations about the Application itself.
 *
 * @author <NAME> <<EMAIL>>
 */
class HealthController extends \luya\console\Command
{
    public $verbose = false;
    
    public $folders = [
        'public_html/assets' => true,
        'public_html/storage' => true,
        'migrations' => false,
        'vendor' => false,
        'runtime' => true,
    ];

    public $files = [
        'configs/env.php',
        'public_html/index.php',
    ];
    
    public function options($actionId)
    {
        return ['verbose'];
    }

    /**
     * Create all required directories an check whether they are writeable or not.
     *
     * @return number
     */
    public function actionIndex()
    {
        $error = false;

        Console::clearScreenBeforeCursor();
        
        @chdir(Yii::getAlias('@app'));

        $this->output('The directory the health commands is applying to: ' . Yii::getAlias('@app'));
        
        foreach ($this->folders as $folder => $writable) {
            if (!file_exists($folder)) {
                $mode = ($writable) ? 0777 : 0775;
                if (FileHelper::createDirectory($folder, $mode)) {
                    $this->outputSuccess("$folder: successfully created directory");
                } else {
                    $error = true;
                    $this->outputError("$folder: unable to create directory");
                }
            } else {
                $this->outputInfo("$folder: directory exists already");
            }
            
            if ($writable && !is_writable($folder)) {
                $this->outputInfo("$folder: is not writeable, try to set mode '$mode'.");
                @chmod($folder, $mode);
            }

            if ($writable) {
                if (!is_writable($folder)) {
                    $error = true;<commit_msg>Update HealthController.php (#1055)<commit_after><?php

namespace luya\console\commands;

use Yii;
use yii\helpers\FileHelper;
use yii\helpers\Console;

/**
 * Health/Status informations about the Application itself.
 *
 * @author <NAME> <<EMAIL>>
 */
class HealthController extends \luya\console\Command
{
    public $verbose = false;
    
    public $folders = [
        'public_html/assets' => true,
        'public_html/storage' => true,
        'migrations' => false,
        'vendor' => false,
        'runtime' => true,
    ];

    public $files = [
        'configs/env.php',
        'public_html/index.php',
    ];
    
    public function options($actionId)
    {
        return ['verbose'];
    }

    /**
     * Create all required directories an check whether they are writeable or not.
     *
     * @return number
     */
    public function actionIndex()
    {
        $error = false;

        Console::clearScreenBeforeCursor();
        
        @chdir(Yii::getAlias('@app'));

        $this->output('The directory the health commands is applying to: ' . Yii::getAlias('@app'));
        
        foreach ($this->folders as $folder => $writable) {
            $mode = ($writable) ? 0777 : 0775;
            if (!file_exists($folder)) {
                if (FileHelper::createDirectory($folder, $mode)) {
                    $this->outputSuccess("$folder: successfully created directory");
                } else {
                    $error = true;
                    $this->outputError("$folder: unable to create directory");
                }
            } else {
                $this->outputInfo("$folder: directory exists already");
            }
            
            if ($writable && !is_writable($folder)) {
                $this->outputInfo("$folder: is not writeable, try to set mode '$mode'.");
                @chmod($folder, $mode);
            }

            if ($writable) {
                if (!is_writable($folder)) {
                    $error = true;
{'fraction_non_alphanumeric': 0.13542193026781202, 'fraction_numerical': 0.005053057099545225, 'mean_word_length': 1.8038243626062322, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4321073', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1070, 'n_words': 255}