Changeset 25051 for documentation


Ignore:
Timestamp:
2012-02-07T11:07:26+13:00 (12 years ago)
Author:
jmt12
Message:

Adding comments and more tests to mkalldir function. Allowing language argument to be passed to CGI version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/php/common.php

    r25026 r25051  
    115115function mkAllDir($destination_dir, $mode)
    116116{
    117   ///cho '<p> * Make all directories: ' . $destination_dir . '</p>' . "\n";
     117  echo '<p> * Make all directories: ' . $destination_dir . '</p>' . "\n";
    118118  $dirs_to_create = array();
    119119  $dir = $destination_dir;
    120120  while (!empty($dir) && !file_exists($dir))
    121121  {
     122    echo 'Does not exist - create...<br/>';
    122123    array_unshift($dirs_to_create, $dir);
    123124    $dir = substr($dir, 0, strrpos($dir, '/'));
     125    echo 'Testing for the existance of: ' . $dir . '<br/>';
    124126  }
    125127  foreach ($dirs_to_create as $dir)
    126128  {
    127     mkdir($dir, 0755);
     129    if (!file_exists($dir))
     130    {
     131      mkdir($dir, 0755);
     132    }
    128133  }
    129134  if (!file_exists($destination_dir))
     
    137142function parseCLIArguments()
    138143{
    139   if ($_SERVER['argc'])
     144  if (isset($_SERVER['argc']) && $_SERVER['argc'] > 0)
    140145  {
    141146    for ($i = 1; $i < $_SERVER['argc'] && !$unknown_argument; $i++)
    142147    {
    143       if (preg_match('/^\-+m/i', $_SERVER['argv'][$i]))
     148      if (preg_match('/^\-+(l|m)/i', $_SERVER['argv'][$i], $matches))
    144149      {
    145150        $i++;
    146         $_REQUEST['m'] = $_SERVER['argv'][$i];
     151        $_REQUEST[$matches[1]] = $_SERVER['argv'][$i];
    147152      }
    148153      else
Note: See TracChangeset for help on using the changeset viewer.