Browse Source

812 Sorring by message, nginx.conf fixed

Had to change asort to usort and nginx refrenced an index_raw.php file that did not exist so I just replaced it with index.php. Added new required logging args to setup files.
mcoccia 11 years ago
parent
commit
d1c0b05601

+ 9 - 4
php-pimf/app/Vanilla/Controller/Hello.php

@@ -18,7 +18,7 @@ class Hello extends Base
    */
    */
   public function jsonAction()
   public function jsonAction()
   {
   {
-    $this->response->asJSON()->send(array("message" => "Hello World!"));
+    $this->response->asJSON()->send(array("message" => "Hello, World!"));
   }
   }
 
 
   /**
   /**
@@ -47,6 +47,11 @@ class Hello extends Base
     $this->response->asJSON()->send($worlds);
     $this->response->asJSON()->send($worlds);
   }
   }
 
 
+  private static function my_cmp($a, $b)
+  {
+    return  strcmp($a["message"], $b["message"]);
+  }
+
   /**
   /**
    * Test 4: Fortunes
    * Test 4: Fortunes
    */
    */
@@ -55,11 +60,11 @@ class Hello extends Base
     $fortunes = Registry::get('em')->fortune->getAll();
     $fortunes = Registry::get('em')->fortune->getAll();
 
 
     $fortunes[] = array(
     $fortunes[] = array(
-      'id' => count($fortunes) + 1,
+      'id' => 0,
       'message' => 'Additional fortune added at request time.'
       'message' => 'Additional fortune added at request time.'
     );
     );
 
 
-    asort($fortunes);
+    usort($fortunes, array($this, "my_cmp"));
 
 
     $view = new View('table.phtml', array('fortunes' => $fortunes));
     $view = new View('table.phtml', array('fortunes' => $fortunes));
 
 
@@ -99,6 +104,6 @@ class Hello extends Base
    */
    */
   public function plaintextAction()
   public function plaintextAction()
   {
   {
-    $this->response->asTEXT()->send('Hello World!');
+    $this->response->asTEXT()->send('Hello, World!');
   }
   }
 }
 }

+ 1 - 1
php-pimf/composer.json

@@ -1,5 +1,5 @@
 {
 {
     "require": {
     "require": {
-        "gjerokrsteski/pimf-framework": "1.8.*"
+        "gjerokrsteski/pimf": "dev-master"
     }
     }
 }
 }

+ 4 - 4
php-pimf/deploy/nginx_raw.conf

@@ -61,11 +61,11 @@ http {
         #    proxy_pass   http://127.0.0.1;
         #    proxy_pass   http://127.0.0.1;
         #}
         #}
 
 
-        root /home/mrobertson/FrameworkBenchmarks/php-pimf/;
-        index  index_raw.php;
+        root /home/tfb/FrameworkBenchmarks/php-pimf/;
+        index  index.php;
 
 
         location / {
         location / {
-            try_files $uri $uri/ /index_raw.php?$uri&$args;
+            try_files $uri $uri/ /index.php?$uri&$args;
         }
         }
 
 
         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
@@ -73,7 +73,7 @@ http {
         location ~ \.php$ {
         location ~ \.php$ {
             try_files $uri =404;
             try_files $uri =404;
             fastcgi_pass   127.0.0.1:9001;
             fastcgi_pass   127.0.0.1:9001;
-            fastcgi_index  index_raw.php;
+            fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        /usr/local/nginx/conf/fastcgi_params;
             include        /usr/local/nginx/conf/fastcgi_params;

+ 2 - 2
php-pimf/deploy/php-pimf

@@ -1,6 +1,6 @@
 <VirtualHost *:8080>
 <VirtualHost *:8080>
-  Alias /php-pimf/ "/home/mrobertson/FrameworkBenchmarks/php-pimf/"
-  <Directory /home/mrobertson/FrameworkBenchmarks/php-pimf/>
+  Alias /php-pimf/ "/home/tfb/FrameworkBenchmarks/php-pimf/"
+  <Directory /home/tfb/FrameworkBenchmarks/php-pimf/>
           Options Indexes FollowSymLinks MultiViews
           Options Indexes FollowSymLinks MultiViews
           #AllowOverride None
           #AllowOverride None
           Order allow,deny
           Order allow,deny

+ 2 - 2
php-pimf/setup.py

@@ -5,7 +5,7 @@ from os.path import expanduser
 
 
 home = expanduser("~")
 home = expanduser("~")
 
 
-def start(args):
+def start(args, logfile, errfile):
   setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
   setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
@@ -22,7 +22,7 @@ def start(args):
     return 0
     return 0
   except subprocess.CalledProcessError:
   except subprocess.CalledProcessError:
     return 1
     return 1
-def stop():
+def stop(logfile, errfile):
   try:
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
     subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)
     subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)

+ 3 - 3
php-pimf/setup_raw.py

@@ -5,21 +5,21 @@ from os.path import expanduser
 
 
 home = expanduser("~")
 home = expanduser("~")
 
 
-def start(args):
+def start(args, logfile, errfile):
   setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
   setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
 
 
   try:
   try:
-    #subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-pimf")
+    subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-pimf")
     subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-pimf/deploy/php-fpm.pid", shell=True)
     subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-pimf/deploy/php-fpm.pid", shell=True)
     subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-pimf/deploy/nginx_raw.conf", shell=True)
     subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-pimf/deploy/nginx_raw.conf", shell=True)
     return 0
     return 0
   except subprocess.CalledProcessError:
   except subprocess.CalledProcessError:
     return 1
     return 1
 
 
-def stop():
+def stop(logfile, errfile):
   try:
   try:
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
     subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
     subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)
     subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)