<commit_before><?php

namespace console\controllers;

use Yii;
use yii\console\Controller;
use yii\db\Query;
use frontend\models\Item;
use frontend\models\ExternalSite;
use frontend\components\HelperBase;
use yii\console\Exception;

class ItempreviewController extends Controller
{
    public function actionUp()
    {
        set_time_limit(0);
        $count = 0;
        $originalFolderPath = HelperBase::getParam('images')['pathToOriginal'];
        /*$rows = Item::find()
                ->select('id, site_id, preview, s_preview, created_at')
                ->where("preview = '' AND s_preview != ''")
                ->asArray()
                ->all();*/
        $query =  (new Query())
            ->from('item')
            ->select('id, site_id, preview, s_preview, created_at')
            ->where("preview = '' AND s_preview != ''");

//        foreach ($rows as $item) {
        foreach ($query->each() as $item) {
            $imageUrl = '';
            if ($item['site_id'] == ExternalSite::HIFI4ALL) {
                $imageUrl = HelperBase::getParam('HiFi4AllPic') . '/' . $item['s_preview'];
            } elseif ($item['site_id'] == ExternalSite::DBA) {
                $imageUrl = $item['s_preview'];
            }
            if (!$imageUrl) continue;
<commit_msg>Update console command for test reason.<commit_after><?php

namespace console\controllers;

use Yii;
use yii\console\Controller;
use yii\db\Query;
use frontend\models\Item;
use frontend\models\ExternalSite;
use frontend\components\HelperBase;
use yii\console\Exception;

class ItempreviewController extends Controller
{
    public function actionUp()
    {
        set_time_limit(0);
        $count = 0;
        $originalFolderPath = HelperBase::getParam('images')['pathToOriginal'];

        // @todo remove
        $originalFolderPath .= 'items/';

        /*$rows = Item::find()
                ->select('id, site_id, preview, s_preview, created_at')
                ->where("preview = '' AND s_preview != ''")
                ->asArray()
                ->all();*/
        $query =  (new Query())
            ->from('item')
            ->select('id, site_id, preview, s_preview, created_at')
            ->where("preview = '' AND s_preview != ''");

//        foreach ($rows as $item) {
        foreach ($query->each() as $item) {
            $imageUrl = '';
            if ($item['site_id'] == ExternalSite::HIFI4ALL) {
                $imageUrl = HelperBase::getParam('HiFi4AllPic') . '/' . $item['s_preview'];
            } elseif ($item['site_id'] == ExternalSite::DBA) {
                $imageUrl = $item['s_preview'];
            }
            if (!$imageUrl) continue;

{'fraction_non_alphanumeric': 0.15860517435320584, 'fraction_numerical': 0.0029996250468691415, 'mean_word_length': 2.24179829890644, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '5098510', 'n_tokens_mistral': 796, 'n_tokens_neox': 781, 'n_words': 161}