OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Public / actions / StaticIndexAction.class.php
diff --git a/webapp/modules/Public/actions/StaticIndexAction.class.php b/webapp/modules/Public/actions/StaticIndexAction.class.php
new file mode 100644 (file)
index 0000000..f166564
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+// $Id: StaticIndexAction.class.php,v 1,0 2007/03/01 09:01:37 w-ota Exp $
+
+class StaticIndexAction extends BaseAction
+{
+       // GET
+       function execute() {
+
+               $context = &$this->getContext();
+               $controller = $context->getController();\r
+               $user = $context->getUser();
+               $request = $context->getRequest();
+
+               $pagefile = ACS_PAGES_DIR . "index.html." . ACSMsg::get_lang();
+               $lockfile = $pagefile.".locked";
+
+               // ÀÅŪ¥Õ¥¡¥¤¥ë½ñ¤­´¹¤¨Ãæ¤Î¾ì¹ç(0.5ÉÃÂÔ¤Ä)
+               if (is_readable($lockfile)) {
+                       usleep(500000);
+               }
+
+               // ½ñ¤­´¹¤¨Ãæ¤Ç¤Ê¤¯¡¢ÀÅŪ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¾ì¹ç
+               if (!is_readable($lockfile) && is_readable($pagefile)) {
+
+                       // ÀÅŪ¥Õ¥¡¥¤¥ëºîÀ®»þ´Ö¤¬Í­¸ú»þ´ÖÈÏ°ÏÆâ¤Î¾ì¹ç
+                       if ((time() - filemtime($pagefile)) <= ACS_PAGES_EFFECTIVE_SEC) {
+
+                               // ÀÅŪ¥È¥Ã¥×¤òɸ½à½ÐÎÏ
+                               mb_http_output('pass');
+                               readfile($pagefile);
+                               return;\r
+
+                       }
+               }
+               $request->setAttribute('force_realtime', 1);
+               $controller->forward("Public", "Index");\r
+       }
+
+       /**
+        * Ç§¾Ú¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¤«
+        * ¥¢¥¯¥·¥ç¥ó¤ò¼Â¹Ô¤¹¤ëÁ°¤Ë¡¢Ç§¾Ú¥Á¥§¥Ã¥¯¤¬É¬Íפ«ÀßÄꤹ¤ë
+        * @access  public
+        * @return  boolean Ç§¾Ú¥Á¥§¥Ã¥¯Í­Ìµ¡Êtrue:ɬÍס¢false:ÉÔÍסË
+        */
+       public function isSecure()
+       {
+               return false;
+       }
+}
+
+?>