Ignore:
Timestamp:
Feb 23, 2010, 3:18:34 PM (14 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] Pre-2.13.4

  • Add of obsolete files management
  • Deletion of obsolete file in trunk
  • changelog.txt.php updated
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php

    r4927 r4952  
    11531153  return $plugin ;
    11541154}
     1155
     1156/* Funtion called in maintain.inc.php to clean obsolete files */
     1157function clean_obsolete_files($obsolete_file_list)
     1158{
     1159  if (!file_exists(NBC_UAM_PATH.$obsolete_file_list))
     1160  {
     1161    return TRUE;
     1162  }
     1163  $obsolete = file(NBC_UAM_PATH.$obsolete_file_list);
     1164  array_push($obsolete, $obsolete_file_list);
     1165  return clean_obsolete_list($obsolete);
     1166}
     1167
     1168function clean_obsolete_list($file_list = array(), &$errors = array())
     1169{
     1170  if (!function_exists('unlink'))
     1171  {
     1172      // No unlink available...
     1173      array_push($errors, l10n('uam_no_unlink'));
     1174      return FALSE;
     1175  }
     1176  $success = TRUE;
     1177  foreach ($file_list as $file)
     1178  {
     1179    $file = NBC_UAM_PATH . $file;
     1180    if (file_exists($file))
     1181    {
     1182      // Remove obsolete file
     1183      $success &= unlink($file);
     1184    }
     1185  }
     1186  if (!$success)
     1187  {
     1188      array_push($errors, l10n('uam_unlink_errors'));
     1189  }
     1190  return $success;
     1191}
    11551192?>
Note: See TracChangeset for help on using the changeset viewer.