dokeos-exercise
[ class tree: dokeos-exercise ] [ index: dokeos-exercise ] [ all elements ]

Source for file GC.php

Documentation is available at GC.php

  1. <?php
  2. /*
  3.     DOKEOS - elearning and course management software
  4.  
  5.     For a full list of contributors, see documentation/credits.html
  6.  
  7.     This program is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU General Public License
  9.     as published by the Free Software Foundation; either version 2
  10.     of the License, or (at your option) any later version.
  11.     See "documentation/licence.html" more details.
  12.  
  13.     Contact:
  14.         Dokeos
  15.         Rue des Palais 44 Paleizenstraat
  16.         B-1030 Brussels - Belgium
  17.         Tel. +32 (2) 211 34 56
  18. */
  19.  
  20.  
  21. /**
  22. *    Code library for HotPotatoes integration.
  23. *    @package dokeos.exercise
  24. *     @author Istvan Mandak
  25. *     @version $Id: GC.php 10789 2007-01-18 19:18:27Z pcool $
  26. */
  27.  
  28.  
  29.         // usage:  HotPotGC($_configuration['root_sys'],$flag);
  30.         // working recursively, flag[0,1] print or delete the HotPotatoes temp files (.t.html)
  31.  
  32.         echo "Garbage Collector<BR>";
  33.         HotPotGC($_configuration['root_sys'],1,1);
  34.  
  35.  
  36.         // functions
  37.  
  38.         function HotPotGC($root_sys,$flag,$userID)
  39.         {
  40.             // flag[0,1] - print or delete the HotPotatoes temp files (.t.html)
  41.             $documentPath $root_sys."courses";
  42.             require_once(api_get_path(LIBRARY_PATH)."fileManage.lib.php");
  43.             HotPotGCt($documentPath,$flag,$userID);
  44.         }
  45.  
  46.         function HotPotGCt($folder,$flag,$userID)
  47.         // Garbage Collector
  48.             $filelist array();
  49.         if ($dir @opendir($folder)) {
  50.         while (($file readdir($dir)) !== false{
  51.             if $file != "."{
  52.                 if ($file != "..")
  53.                       {
  54.                  $full_name $folder."/".$file;
  55.                       if (is_dir($full_name))
  56.                                     {
  57.                                         HotPotGCt($folder."/".$file,$flag);
  58.                                     }
  59.                                 else
  60.                                  {
  61.                         $filelist[$file;
  62.                  }
  63.                }
  64.             }
  65.         }
  66.           closedir($dir);
  67.         }
  68.             while (list ($key$valeach ($filelist))
  69.             {
  70.                  if (stristr($val,$userID.".t.html"))
  71.                  if ($flag == 1)
  72.                          {
  73.                                 my_delete($folder."/".$val);
  74.                         }
  75.                      else
  76.                       {
  77.                           echo $folder."/".$val."<BR>";
  78.                       }
  79.                  }
  80.             }
  81.         }
  82.  
  83.  
  84. ?>

Documentation generated on Thu, 12 Jun 2008 13:32:24 -0500 by phpDocumentor 1.4.1