瀏覽代碼

Update Generate.php

Visman 4 年之前
父節點
當前提交
e08996cccd
共有 1 個文件被更改,包括 4 次插入10 次删除
  1. 4 10
      app/Models/BBCodeList/Generate.php

+ 4 - 10
app/Models/BBCodeList/Generate.php

@@ -8,12 +8,6 @@ use RuntimeException;
 
 
 class Generate extends Method
 class Generate extends Method
 {
 {
-    /**
-     * Содержимое генерируемого файла
-     * @var string
-     */
-    protected $file;
-
     /**
     /**
      * Создает файл с массивом сгенерированных bbcode
      * Создает файл с массивом сгенерированных bbcode
      */
      */
@@ -22,18 +16,18 @@ class Generate extends Method
         $query = 'SELECT bb_structure
         $query = 'SELECT bb_structure
             FROM ::bbcode';
             FROM ::bbcode';
 
 
-        $this->file = "<?php\n\nuse function \\ForkBB\\__;\n\nreturn [\n";
+        $content = "<?php\n\nuse function \\ForkBB\\__;\n\nreturn [\n";
 
 
         $stmt = $this->c->DB->query($query);
         $stmt = $this->c->DB->query($query);
         while ($row = $stmt->fetch()) {
         while ($row = $stmt->fetch()) {
-            $this->file .= "    [\n"
+            $content .= "    [\n"
                 . $this->addArray(\json_decode($row['bb_structure'], true, 512, \JSON_THROW_ON_ERROR))
                 . $this->addArray(\json_decode($row['bb_structure'], true, 512, \JSON_THROW_ON_ERROR))
                 . "    ],\n";
                 . "    ],\n";
         }
         }
 
 
-        $this->file .= "];\n";
+        $content .= "];\n";
 
 
-        if (false === \file_put_contents($this->model->fileCache, $this->file, \LOCK_EX)) {
+        if (false === \file_put_contents($this->model->fileCache, $content, \LOCK_EX)) {
             throw new RuntimeException('The generated bbcode file cannot be created');
             throw new RuntimeException('The generated bbcode file cannot be created');
         } else {
         } else {
             return $this->model->invalidate();
             return $this->model->invalidate();