Project

General

Profile

Enhancement(機能追加・改善) #1199

[optimization] OpenPNE.ymlの結果をキャッシュするようにする

Added by Yuki Kan over 10 years ago. Updated over 10 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Target version:
Start date:
2010-06-23
Due date:
2010-06-23
% Done:

100%


Description

lib/config/opProjectConfiguration.class.php:118-

-    $path = OPENPNE3_CONFIG_DIR.'/OpenPNE.yml';
-    $config = sfYaml::load($path.'.sample');
-    if (is_readable($path))
+    $opConfigCachePath = sfConfig::get('sf_cache_dir').DIRECTORY_SEPARATOR.'OpenPNE.yml.php';
+    if (is_readable($opConfigCachePath))

lib/config/opProjectConfiguration.class.php:121-

-      $config = array_merge($config, sfYaml::load($path));
+      $config = (array)include($opConfigCachePath);
     }
+    else
+    {
+      $path = OPENPNE3_CONFIG_DIR.'/OpenPNE.yml';
+      $config = sfYaml::load($path.'.sample');
+      if (is_readable($path))
+      {
+        $config = array_merge($config, sfYaml::load($path));
+      }

+      file_put_contents($opConfigCachePath, '<?php return '.var_export($config, true).';');
+    }


Related issues

Related to OpenPNE 3 - Enhancement(機能追加・改善) #1345: sfOpenPNEApplicationConfiguration::globEnablePlugin() の結果をキャッシュする Fixed(完了) 2010-07-14

Associated revisions

Revision 164536a4 (diff)
Added by Yuki Kan over 10 years ago

fixed: changed to use cache by result of OpenPNE.yml(fixes #1199)

Revision 1febc82d (diff)
Added by Kousuke Ebihara over 10 years ago

fixed a permission of cache directory for OpenPNE.yml is not right (fixes #1199)

History

#1 Updated by Yuki Kan over 10 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

更新履歴 164536a49332cf6b9abbb676fc572e4e5523ba71 で適用されました。

#2 Updated by Rimpei Ogawa over 10 years ago

  • Status changed from Pending Review(レビュー待ち) to Rejected(差し戻し)

2点修正してください。

  • キャッシュディレクトリがない状態(git clone した直後など)に file_put_contents() でエラーが発生します
  • 131行目に不要なスペースがあります

#3 Updated by Shogo Kawahara over 10 years ago

この点も差し戻し

  • ファイルのパーミッションの問題によりキャッシュ削除時にWarningが起こるようです
>> file-     /home/kawahara/dev/OpenPNE3/cache/www-data/OpenPNE.yml.php
PHP Warning:  unlink(/home/kawahara/dev/OpenPNE3/cache/www-data/OpenPNE.yml.php): Permission denied in /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/task/sfFilesystem.class.php on line 143
PHP Stack trace:
PHP   1. {main}() /usr/bin/symfony:0
PHP   2. include() /usr/bin/symfony:37
PHP   3. sfSymfonyCommandApplication->run() /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/command/cli.php:20
PHP   4. sfTask->runFromCLI() /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/command/sfSymfonyCommandApplication.class.php:76
PHP   5. sfBaseTask->doRun() /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/task/sfTask.class.php:97
PHP   6. sfCacheClearTask->execute() /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/task/sfBaseTask.class.php:68
PHP   7. sfFilesystem->remove() /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/task/cache/sfCacheClearTask.class.php:128
PHP   8. unlink() /home/kawahara/dev/OpenPNE3/lib/vendor/symfony/lib/task/sfFilesystem.class.php:143
>> file-     /home/kawahara/dev/OpenPNE3/cache/OpenPNE.yml.php

#4 Updated by Shogo Kawahara over 10 years ago

  • Subject changed from OpenPNE.ymlの結果をキャッシュするようにする to [optimization] OpenPNE.ymlの結果をキャッシュするようにする

#5 Updated by Kousuke Ebihara over 10 years ago

  • Status changed from Rejected(差し戻し) to Accepted(着手)
  • Assignee changed from Yuki Kan to Kousuke Ebihara

#6 Updated by Kousuke Ebihara over 10 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)

更新履歴 1febc82d72407a957efb3533f7ca7b5925b54967 で適用されました。

#7 Updated by Shogo Kawahara over 10 years ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70

#8 Updated by Kousuke Ebihara over 10 years ago

  • Status changed from Pending Testing(テスト待ち) to Fixed(完了)
  • % Done changed from 70 to 100

Also available in: Atom PDF