You are here

function PclZipUtilRename in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/pclzip/pclzip.lib.php \PclZipUtilRename()
3 calls to PclZipUtilRename()
PclZip::privAdd in includes/moodle/lib/pclzip/pclzip.lib.php
PclZip::privDeleteByRule in includes/moodle/lib/pclzip/pclzip.lib.php
PclZip::privMerge in includes/moodle/lib/pclzip/pclzip.lib.php

File

includes/moodle/lib/pclzip/pclzip.lib.php, line 5660

Code

function PclZipUtilRename($p_src, $p_dest) {

  //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
  $v_result = 1;

  // ----- Try to rename the files
  if (!@rename($p_src, $p_dest)) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");

    // ----- Try to copy & unlink the src
    if (!@copy($p_src, $p_dest)) {

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
      $v_result = 0;
    }
    else {
      if (!@unlink($p_src)) {

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
        $v_result = 0;
      }
    }
  }

  // ----- Return

  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
  return $v_result;
}