Changeset 13003 for trunk


Ignore:
Timestamp:
Jan 31, 2012, 4:09:07 PM (12 years ago)
Author:
plg
Message:

remove obsolete function add_file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_functions.inc.php

    r12922 r13003  
    16011601    unlink($chunk);
    16021602  }
    1603 }
    1604 
    1605 /*
    1606  * The $file_path must be the path of the basic "web sized" photo
    1607  * The $type value will automatically modify the $file_path to the corresponding file
    1608  */
    1609 function add_file($file_path, $type, $original_sum, $file_sum)
    1610 {
    1611   include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    1612 
    1613   $upload_dir = dirname($file_path);
    1614   if (substr(PHP_OS, 0, 3) == 'WIN')
    1615   {
    1616     $upload_dir = str_replace('/', DIRECTORY_SEPARATOR, $upload_dir);
    1617   }
    1618 
    1619   ws_logfile('[add_file] file_path  : '.$file_path);
    1620   ws_logfile('[add_file] upload_dir : '.$upload_dir);
    1621 
    1622   if (!is_dir($upload_dir)) {
    1623     umask(0000);
    1624     $recursive = true;
    1625     if (!@mkdir($upload_dir, 0777, $recursive))
    1626     {
    1627       return new PwgError(500, '[add_file] error during '.$type.' directory creation');
    1628     }
    1629   }
    1630 
    1631   if (!is_writable($upload_dir))
    1632   {
    1633     // last chance to make the directory writable
    1634     @chmod($upload_dir, 0777);
    1635 
    1636     if (!is_writable($upload_dir))
    1637     {
    1638       return new PwgError(500, '[add_file] '.$type.' directory has no write access');
    1639     }
    1640   }
    1641 
    1642   secure_directory($upload_dir);
    1643 
    1644   // merge the file
    1645   merge_chunks($file_path, $original_sum, $type);
    1646   chmod($file_path, 0644);
    1647 
    1648   // check dumped thumbnail md5
    1649   $dumped_md5 = md5_file($file_path);
    1650   if ($dumped_md5 != $file_sum)
    1651   {
    1652     return new PwgError(500, '[add_file] '.$type.' transfer failed');
    1653   }
    1654 
    1655   list($width, $height) = getimagesize($file_path);
    1656   $filesize = floor(filesize($file_path)/1024);
    1657 
    1658   return array(
    1659     'width' => $width,
    1660     'height' => $height,
    1661     'filesize' => $filesize,
    1662     );
    16631603}
    16641604
Note: See TracChangeset for help on using the changeset viewer.