php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61942
Patch opcode_view_patch revision 2012-05-04 19:24 UTC by bug at s-seven dot net
revision 2012-05-04 19:16 UTC by bug at s-seven dot net
revision 2012-05-04 19:10 UTC by bug at s-seven dot net

Patch opcode_view_patch for APC Bug #61942

Patch version 2012-05-04 19:24 UTC

Return to Bug #61942 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: bug@s-seven.net

diff --git a/APC-3.1.10/apc.php b/apc.php
old mode 100644
new mode 100644
index adf8290..837eea2
--- a/build/APC-3.1.10/APC-3.1.10/apc.php
+++ b/apc.php
@@ -51,6 +51,9 @@ defaults('GRAPH_SIZE',200);                                   // Image size
 
 //defaults('PROXY', 'tcp://127.0.0.1:8080');
 
+// %s for full path to filename...
+//defaults('OPCODE_COMMAND', 'php -dvld.active=1 -dvld.execute=0 -dvld.dump_paths=0 -dvld.verbosity=0 %s 2>&1');
+
 ////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////
 
 
@@ -82,6 +85,7 @@ $vardom=array(
        'CC'    => '/^[01]$/',                  // clear cache requested
        'DU'    => '/^.*$/',                    // Delete User Key
        'SH'    => '/^[a-z0-9]+$/',             // shared object description
+       'OP'    => '/^[01]$/',                          // opcode display
 
        'IMG'   => '/^[123]$/',                 // image to generate
        'LO'    => '/^1$/',                             // login requested
@@ -981,6 +985,7 @@ EOB;
                                                // hide all path entries if not logged in
                                                $value=preg_replace('/^.*(\\/|\\\\)/','<i>&lt;hidden&gt;</i>/',$value);
                                        }
+                                       elseif ($k == "filename") $opcode_filename = $value;
 
                                        if ($k == "num_hits") {
                                                $value=sprintf("%s (%.2f%%)",$value,$value*100/$cache['num_hits']);
@@ -1009,6 +1014,29 @@ EOB;
                        </tbody></table>
                        </div>
 EOB;
+
+if ($AUTHENTICATED)
+{
+       if (defined('OPCODE_COMMAND') && OPCODE_COMMAND && isset($opcode_filename) && $opcode_filename)
+       {
+               clearstatcache();
+               if (file_exists($opcode_filename))
+               {
+                       echo "<hr><p><ol class=menu>";
+                       echo sprintf("<li><a %s href=\"{$MY_SELF}&OB={$MYREQUEST['OB']}&SH={$MYREQUEST['SH']}&OP=%d\">%s opcode</a></li>",
+                               $MYREQUEST['OP']?'class="child_active"':'', (int)!$MYREQUEST['OP'], $MYREQUEST['OP']?'Hide':'Show');
+                       echo"</ol></p><hr>";
+
+                       if ($MYREQUEST['OP'] == 1)
+                       {
+                               echo "<pre>";
+                               system(sprintf(OPCODE_COMMAND, $opcode_filename));
+                               echo "</pre>";
+                       }
+               }
+       }
+}
+
                break;
        }
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jul 29 02:01:22 2021 UTC