Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.156 diff -u -9 -p -r1.156 install.php --- install.php 18 Feb 2009 15:07:26 -0000 1.156 +++ install.php 22 Feb 2009 13:02:25 -0000 @@ -414,19 +414,19 @@ function install_find_profiles() { * The selected profile. */ function install_select_profile() { include_once DRUPAL_ROOT . '/includes/form.inc'; $profiles = install_find_profiles(); // Don't need to choose profile if only one available. if (sizeof($profiles) == 1) { $profile = array_pop($profiles); - require_once $profile->filename; + require_once $profile->filepath; return $profile->name; } elseif (sizeof($profiles) > 1) { foreach ($profiles as $profile) { if (!empty($_POST['profile']) && ($_POST['profile'] == $profile->name)) { return $profile->name; } } @@ -445,19 +445,19 @@ function install_select_profile() { * Array of metadata about state of form processing. * @param $profile_files * Array of .profile files, as returned from file_scan_directory(). */ function install_select_profile_form(&$form_state, $profile_files) { $profiles = array(); $names = array(); foreach ($profile_files as $profile) { - include_once DRUPAL_ROOT . '/' . $profile->filename; + include_once DRUPAL_ROOT . '/' . $profile->filepath; // Load profile details and store them for later retrieval. $function = $profile->name . '_profile_details'; if (function_exists($function)) { $details = $function(); } $profiles[$profile->name] = $details; // Determine the name of the profile; default to file name if defined name Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.159 diff -u -9 -p -r1.159 file.inc --- includes/file.inc 18 Feb 2009 15:19:54 -0000 1.159 +++ includes/file.inc 22 Feb 2009 13:02:26 -0000 @@ -1389,64 +1389,63 @@ function file_download() { * '/(\.\.?|CVS)$/'. * - 'callback' * The callback function to call for each match. There is no default * callback. * - 'recurse' * When TRUE, the directory scan will recurse the entire tree starting at * the provided directory. Defaults to TRUE. * - 'key' * The key to be used for the returned array of files. Possible values are - * "filename", for the path starting with $dir, "basename", for the - * basename of the file, and "name" for the name of the file without an - * extension. Defaults to 'filename'. + * 'filepath', for the path starting with $dir, 'filename', for the + * basename of the file, and 'name' for the name of the file without an + * extension. Defaults to 'filepath'. * - 'min_depth' * Minimum depth of directories to return files from. Defaults to 0. * @param $depth * Current depth of recursion. This parameter is only used internally and * should not be passed. * @return * An associative array (keyed on the provided key) of objects with - * "filename", "basename", and "name" members corresponding to the - * matching files. + * 'filepath', 'filename', and 'name' members corresponding to the + * matching files. */ function file_scan_directory($dir, $mask, $options = array(), $depth = 0) { // Merge in defaults. $options += array( 'nomask' => '/(\.\.?|CVS)$/', 'callback' => 0, 'recurse' => TRUE, - 'key' => 'filename', + 'key' => 'filepath', 'min_depth' => 0, ); - $options['key'] = (in_array($options['key'], array('filename', 'basename', 'name')) ? $options['key'] : 'filename'); + $options['key'] = in_array($options['key'], array('filepath', 'filename', 'name')) ? $options['key'] : 'filepath'; $files = array(); - if (is_dir($dir) && $handle = opendir($dir)) { - while (FALSE !== ($file = readdir($handle))) { - if (!preg_match($options['nomask'], $file) && $file[0] != '.') { - if (is_dir("$dir/$file") && $options['recurse']) { + while (FALSE !== ($filename = readdir($handle))) { + if (!preg_match($options['nomask'], $filename) && $filename[0] != '.') { + $filepath = "$dir/$filename"; + if (is_dir($filepath) && $options['recurse']) { // Give priority to files in this folder by merging them in after any subdirectory files. - $files = array_merge(file_scan_directory("$dir/$file", $mask, $options, $depth + 1), $files); + $files = array_merge(file_scan_directory($filepath, $mask, $options, $depth + 1), $files); } - elseif ($depth >= $options['min_depth'] && preg_match($mask, $file)) { + elseif ($depth >= $options['min_depth'] && preg_match($mask, $filename)) { // Always use this match over anything already set in $files with the // same $$options['key']. - $filename = "$dir/$file"; - $basename = basename($file); - $name = substr($basename, 0, strrpos($basename, '.')); - $files[${$options['key']}] = (object) array( + $file = (object) array( + 'filepath' => $filepath, 'filename' => $filename, - 'basename' => $basename, - 'name' => $name, + 'name' => pathinfo($filename, PATHINFO_FILENAME), ); + $key = $options['key']; + $files[$file->$key] = $file; if ($options['callback']) { - $options['callback']($filename); + $options['callback']($filepath); } } } } closedir($handle); } return $files; Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.84 diff -u -9 -p -r1.84 install.inc --- includes/install.inc 18 Feb 2009 15:07:27 -0000 1.84 +++ includes/install.inc 22 Feb 2009 13:02:26 -0000 @@ -210,21 +210,21 @@ function drupal_detect_database_types() $databases = array(); // We define a driver as a directory in /includes/database that in turn // contains a database.inc file. That allows us to drop in additional drivers // without modifying the installer. // Because we have no registry yet, we need to also include the install.inc // file for the driver explicitly. foreach (file_scan_directory(DRUPAL_ROOT . '/includes/database', '/^[a-z]*$/i', array('recurse' => FALSE)) as $file) { - include_once "{$file->filename}/install.inc"; - include_once "{$file->filename}/database.inc"; - $drivers[$file->basename] = $file->filename; + include_once "{$file->filepath}/install.inc"; + include_once "{$file->filepath}/database.inc"; + $drivers[$file->filename] = $file->filepath; } foreach ($drivers as $driver => $file) { $class = 'DatabaseInstaller_' . $driver; $installer = new $class(); if ($installer->installable()) { $databases[$driver] = $installer->name(); } } @@ -928,19 +928,19 @@ function drupal_check_profile($profile) $function = $profile . '_profile_modules'; $module_list = array_unique(array_merge(drupal_required_modules(), $function())); // Get a list of all .install files. $installs = drupal_get_install_files($module_list); // Collect requirement testing results $requirements = array(); foreach ($installs as $install) { - require_once DRUPAL_ROOT . '/' . $install->filename; + require_once DRUPAL_ROOT . '/' . $install->filepath; $function = $install->name. '_requirements'; if (function_exists($function)) { $requirements = array_merge($requirements, $function('install')); } } return $requirements; } /** @@ -968,19 +968,19 @@ function drupal_requirements_severity(&$ * @param $module * Machine name of module to check. * @return * TRUE/FALSE depending on the requirements are in place. */ function drupal_check_module($module) { // Include install file $install = drupal_get_install_files(array($module)); if (isset($install[$module])) { - require_once DRUPAL_ROOT . '/' . $install[$module]->filename; + require_once DRUPAL_ROOT . '/' . $install[$module]->filepath; // Check requirements $requirements = module_invoke($module, 'requirements', 'install'); if (is_array($requirements) && drupal_requirements_severity($requirements) == REQUIREMENT_ERROR) { // Print any error messages foreach ($requirements as $requirement) { if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { $message = $requirement['description']; if (isset($requirement['value']) && $requirement['value']) { Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.204 diff -u -9 -p -r1.204 locale.inc --- includes/locale.inc 18 Feb 2009 15:07:27 -0000 1.204 +++ includes/locale.inc 22 Feb 2009 13:02:26 -0000 @@ -2669,32 +2669,33 @@ function locale_batch_by_component($comp * @return * A batch structure */ function _locale_batch_build($files, $finished = NULL, $components = array()) { $t = get_t(); if (count($files)) { $operations = array(); foreach ($files as $file) { // We call _locale_batch_import for every batch operation. - $operations[] = array('_locale_batch_import', array($file->filename)); } - $batch = array( - 'operations' => $operations, - 'title' => $t('Importing interface translations'), - 'init_message' => $t('Starting import'), - 'error_message' => $t('Error importing interface translations'), - 'file' => 'includes/locale.inc', - // This is not a batch API construct, but data passed along to the - // installer, so we know what did we import already. - '#components' => $components, - ); - if (isset($finished)) { - $batch['finished'] = $finished; - } + $operations[] = array('_locale_batch_import', array($file->filepath)); + } + $batch = array( + 'operations' => $operations, + 'title' => $t('Importing interface translations'), + 'init_message' => $t('Starting import'), + 'error_message' => $t('Error importing interface translations'), + 'file' => 'includes/locale.inc', + // This is not a batch API construct, but data passed along to the + // installer, so we know what did we import already. + '#components' => $components, + ); + if (isset($finished)) { + $batch['finished'] = $finished; + } return $batch; } return FALSE; } /** * Perform interface translation import as a batch step. * * @param $filepath Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.138 diff -u -9 -p -r1.138 module.inc --- includes/module.inc 14 Jan 2009 12:18:37 -0000 1.138 +++ includes/module.inc 22 Feb 2009 13:02:26 -0000 @@ -95,53 +95,53 @@ function module_rebuild_cache() { 'dependencies' => array(), 'dependents' => array(), 'description' => '', 'package' => 'Other', 'version' => NULL, 'php' => DRUPAL_MINIMUM_PHP, 'files' => array(), ); - foreach ($files as $filename => $file) { + foreach ($files as $filepath => $file) { // Look for the info file. - $file->info = drupal_parse_info_file(dirname($file->filename) . '/' . $file->name . '.info'); + $file->info = drupal_parse_info_file(dirname($file->filepath) . '/' . $file->name . '.info'); // Skip modules that don't provide info. if (empty($file->info)) { - unset($files[$filename]); + unset($files[$filepath]); continue; } // Merge in defaults and save. - $files[$filename]->info = $file->info + $defaults; + $files[$filepath]->info = $file->info + $defaults; // Invoke hook_system_info_alter() to give installed modules a chance to // modify the data in the .info files if necessary. - drupal_alter('system_info', $files[$filename]->info, $files[$filename]); + drupal_alter('system_info', $files[$filepath]->info, $files[$filepath]); // Update the contents of the system table: - if (isset($file->status) || (isset($file->old_filename) && $file->old_filename != $file->filename)) { + if (isset($file->status) || (isset($file->old_filepath) && $file->old_filepath != $file->filepath)) { db_update('system') ->fields(array( - 'info' => serialize($files[$filename]->info), + 'info' => serialize($files[$filepath]->info), 'name' => $file->name, - 'filename' => $file->filename)) - ->condition('filename', $file->old_filename) + 'filename' => $file->filepath)) + ->condition('filename', $file->old_filepath) ->execute(); } else { // This is a new module. - $files[$filename]->status = 0; + $files[$filepath]->status = 0; db_insert('system') ->fields(array( 'name' => $file->name, - 'info' => serialize($files[$filename]->info), + 'info' => serialize($files[$filepath]->info), 'type' => 'module', - 'filename' => $file->filename, + 'filename' => $file->filepath, 'status' => 0)) ->execute(); } } $files = _module_build_dependencies($files); return $files; } /** @@ -529,16 +529,16 @@ function module_invoke_all() { */ /** * Array of modules required by core. */ function drupal_required_modules() { $files = drupal_system_listing('/\.info$/', 'modules', 'name', 0); $required = array(); foreach ($files as $name => $file) { - $info = drupal_parse_info_file($file->filename); + $info = drupal_parse_info_file($file->filepath); if (!empty($info) && !empty($info['required']) && $info['required']) { $required[] = $name; } } return $required; } Index: includes/registry.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/registry.inc,v retrieving revision 1.11 diff -u -9 -p -r1.11 registry.inc --- includes/registry.inc 20 Dec 2008 18:24:33 -0000 1.11 +++ includes/registry.inc 22 Feb 2009 13:02:26 -0000 @@ -37,19 +37,19 @@ function _registry_rebuild() { require_once DRUPAL_ROOT . '/includes/database/select.inc'; require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/query.inc'; // Reset the resources cache. _registry_get_resource_name(); // Get the list of files we are going to parse. $files = array(); foreach (module_rebuild_cache() as $module) { if ($module->status) { - $dir = dirname($module->filename); + $dir = dirname($module->filepath); foreach ($module->info['files'] as $file) { $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight); } } } foreach (file_scan_directory('includes', '/\.inc$/') as $filename => $file) { $files["$filename"] = array('module' => '', 'weight' => 0); } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.469 diff -u -9 -p -r1.469 theme.inc --- includes/theme.inc 5 Feb 2009 03:42:56 -0000 1.469 +++ includes/theme.inc 22 Feb 2009 13:02:26 -0000 @@ -825,34 +825,34 @@ function drupal_find_theme_templates($ca $subtheme_paths = isset($theme_paths[$theme]) ? $theme_paths[$theme] : array(); // Escape the periods in the extension. $regex = '/'. str_replace('.', '\.', $extension) . '$/'; // Because drupal_system_listing works the way it does, we check for real // templates separately from checking for patterns. $files = drupal_system_listing($regex, $path, 'name', 0); foreach ($files as $template => $file) { // Ignore sub-theme templates for the current theme. - if (strpos($file->filename, str_replace($subtheme_paths, '', $file->filename)) !== 0) { + if (strpos($file->filepath, str_replace($subtheme_paths, '', $file->filepath)) !== 0) { continue; } // Chop off the remaining extensions if there are any. $template already // has the rightmost extension removed, but there might still be more, // such as with .tpl.php, which still has .tpl in $template at this point. if (($pos = strpos($template, '.')) !== FALSE) { $template = substr($template, 0, $pos); } // Transform - in filenames to _ to match function naming scheme // for the purposes of searching. $hook = strtr($template, '-', '_'); if (isset($cache[$hook])) { $templates[$hook] = array( 'template' => $template, - 'path' => dirname($file->filename), + 'path' => dirname($file->filepath), ); } // Ensure that the pattern is maintained from base themes to its sub-themes. // Each sub-theme will have their templates scanned so the pattern must be // held for subsequent runs. if (isset($cache[$hook]['pattern'])) { $templates[$hook]['pattern'] = $cache[$hook]['pattern']; } } @@ -866,19 +866,19 @@ function drupal_find_theme_templates($ca $pattern = strtr($info['pattern'], '_', '-'); $matches = preg_grep('/^' . $pattern . '/', $patterns); if ($matches) { foreach ($matches as $match) { $file = substr($match, 0, strpos($match, '.')); // Put the underscores back in for the hook name and register this pattern. $templates[strtr($file, '-', '_')] = array( 'template' => $file, - 'path' => dirname($files[$match]->filename), + 'path' => dirname($files[$match]->filepath), 'arguments' => $info['arguments'], ); } } } } return $templates; } Index: modules/blogapi/blogapi.test =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.test,v retrieving revision 1.8 diff -u -9 -p -r1.8 blogapi.test --- modules/blogapi/blogapi.test 30 Dec 2008 16:43:15 -0000 1.8 +++ modules/blogapi/blogapi.test 22 Feb 2009 13:02:26 -0000 @@ -62,19 +62,19 @@ class BlogAPITestCase extends DrupalWebT $this->assertTrue(false, 'Post found.'); // Edit post. $content_new = $this->randomName(10); $result = xmlrpc($local, 'blogger.editPost', $appid, $nid, $web_user->name, $web_user->pass_raw, $content_new, TRUE); $this->assertTrue($result, t('Post successfully modified.')); // Upload file. $file = current($this->drupalGetTestFiles('text')); - $file_contents = file_get_contents($file->filename); + $file_contents = file_get_contents($file->filepath); $file = array(); $file['name'] = $this->randomName() . '.txt'; $file['type'] = 'text'; $file['bits'] = xmlrpc_base64($file_contents); $result = xmlrpc($local, 'metaWeblog.newMediaObject', $blog_id, $web_user->name, $web_user->pass_raw, $file); $this->assertTrue($result, t('File successfully uploaded.')); $url = (array_key_exists('url', $result) ? $result['url'] : ''); Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.84 diff -u -9 -p -r1.84 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 13 Feb 2009 00:39:01 -0000 1.84 +++ modules/simpletest/drupal_web_test_case.php 22 Feb 2009 13:02:26 -0000 @@ -587,35 +587,35 @@ class DrupalWebTestCase { // Make sure type is valid. if (in_array($type, array('binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'))) { // Use original file directory instead of one created during setUp(). $path = $this->originalFileDirectory . '/simpletest'; $files = file_scan_directory($path, '/' . $type . '\-.*/'); // If size is set then remove any files that are not of that size. if ($size !== NULL) { foreach ($files as $file) { - $stats = stat($file->filename); + $stats = stat($file->filepath); if ($stats['size'] != $size) { - unset($files[$file->filename]); + unset($files[$file->filepath]); } } } } usort($files, array($this, 'drupalCompareFiles')); return $files; } /** * Compare two files based on size and file name. */ protected function drupalCompareFiles($file1, $file2) { // Determine which file is larger. - $compare_size = (filesize($file1->filename) > filesize($file2->filename)); + $compare_size = (filesize($file1->filepath) > filesize($file2->filepath)); if (!$compare_size) { // Both files were the same size, so return whichever one is alphabetically greater. return strnatcmp($file1->name, $file2->name); } else { // Return TRUE if $file1 is larger than $file2. return $compare_size; } } Index: modules/simpletest/simpletest.install =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.install,v retrieving revision 1.15 diff -u -9 -p -r1.15 simpletest.install --- modules/simpletest/simpletest.install 1 Feb 2009 17:11:00 -0000 1.15 +++ modules/simpletest/simpletest.install 22 Feb 2009 13:02:26 -0000 @@ -27,19 +27,19 @@ function simpletest_install() { $generated = TRUE; } // Copy other test files for consistency. $files = file_scan_directory($path, '/(html|image|javascript|php|sql)-.*/'); if (count($files) == 0) { $original = drupal_get_path('module', 'simpletest') . '/files'; $files = file_scan_directory($original, '/(html|image|javascript|php|sql)-.*/'); foreach ($files as $file) { - file_unmanaged_copy($file->filename, $path . '/' . $file->basename); + file_unmanaged_copy($file->filepath, $path); } $generated = TRUE; } if ($generated) { drupal_set_message('Extra test files generated.'); } } } Index: modules/simpletest/simpletest.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v retrieving revision 1.37 diff -u -9 -p -r1.37 simpletest.module --- modules/simpletest/simpletest.module 20 Feb 2009 03:37:58 -0000 1.37 +++ modules/simpletest/simpletest.module 22 Feb 2009 13:02:26 -0000 @@ -459,19 +459,19 @@ function simpletest_get_all_tests() { $module_path = drupal_get_path('module', $module); $test = $module_path . "/$module.test"; if (file_exists($test)) { $files[] = $test; } $tests_directory = $module_path . '/tests'; if (is_dir($tests_directory)) { foreach (file_scan_directory($tests_directory, '/\.test$/') as $file) { - $files[] = $file->filename; + $files[] = $file->filepath; } } } $existing_classes = get_declared_classes(); foreach ($files as $file) { include_once DRUPAL_ROOT . '/' . $file; } $classes = array_values(array_diff(get_declared_classes(), $existing_classes)); Index: modules/simpletest/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/file.test,v retrieving revision 1.24 diff -u -9 -p -r1.24 file.test --- modules/simpletest/tests/file.test 18 Feb 2009 15:07:27 -0000 1.24 +++ modules/simpletest/tests/file.test 22 Feb 2009 13:02:26 -0000 @@ -15,35 +15,35 @@ function file_test_validator($file, $err } /** * Helper function for testing file_scan_directory(). * * Each time the function is called the file is stored in a static variable. * When the function is called with $reset parameter TRUE the cache is cleared * and the results returned. * - * @param $file - * File object + * @param $filepath + * File path * @param $reset * Boolean indicating that the stored files should be removed and returned. * @return * An array of all previous $file parameters since $reset was last called. */ -function file_test_file_scan_callback($file, $reset = FALSE) { +function file_test_file_scan_callback($filepath, $reset = FALSE) { static $files = array(); if ($reset) { $ret = $files; $files = array(); return $ret; } - $files[] = $file; + $files[] = $filepath; } /** * Base class for file tests that adds some additional file specific * assertions and helper functions. */ class FileTestCase extends DrupalWebTestCase { /** * Check that two files have the same values for all fields other than the @@ -519,26 +519,26 @@ class FileSaveUploadTest extends FileHoo ); } function setUp() { parent::setUp(); $account = $this->drupalCreateUser(array('access content')); $this->drupalLogin($account); $this->image = current($this->drupalGetTestFiles('image')); - $this->assertTrue(is_file($this->image->filename), t("The file we're going to upload exists.")); + $this->assertTrue(is_file($this->image->filepath), t("The file we're going to upload exists.")); $this->maxFidBefore = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); // Upload with replace to gurantee there's something there. $edit = array( 'file_test_replace' => FILE_EXISTS_REPLACE, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!'), t('Found the success message.')); // Check that the correct hooks were called then clean out the hook // counters. $this->assertFileHooksCalled(array('validate', 'insert')); file_test_reset(); @@ -553,19 +553,19 @@ class FileSaveUploadTest extends FileHoo $file1 = file_load($max_fid_after); $this->assertTrue($file1, t('Loaded the file.')); // Reset the hook counters to get rid of the 'load' we just called. file_test_reset(); // Upload a second file. $max_fid_before = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); $image2 = current($this->drupalGetTestFiles('image')); - $edit = array('files[file_test_upload]' => realpath($image2->filename)); + $edit = array('files[file_test_upload]' => realpath($image2->filepath)); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!')); $max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); // Check that the correct hooks were called. $this->assertFileHooksCalled(array('validate', 'insert')); $file2 = file_load($max_fid_after); @@ -578,51 +578,51 @@ class FileSaveUploadTest extends FileHoo } /** * Test renaming when uploading over a file that already exists. */ function testExistingRename() { $edit = array( 'file_test_replace' => FILE_EXISTS_RENAME, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!'), t('Found the success message.')); // Check that the correct hooks were called. $this->assertFileHooksCalled(array('validate', 'insert')); } /** * Test replacement when uploading over a file that already exists. */ function testExistingReplace() { $edit = array( 'file_test_replace' => FILE_EXISTS_REPLACE, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!'), t('Found the success message.')); // Check that the correct hooks were called. $this->assertFileHooksCalled(array('validate', 'load', 'update')); } /** * Test for failure when uploading over a file that already exists. */ function testExistingError() { $edit = array( 'file_test_replace' => FILE_EXISTS_ERROR, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('Epic upload FAIL!'), t('Found the failure message.')); // Check that the no hooks were called while failing. $this->assertFileHooksCalled(array()); } @@ -823,28 +823,28 @@ class FileScanDirectoryTest extends File function testReturn() { // Grab a listing of all the JavaSscript files and check that they're // passed to the callback. $all_files = file_scan_directory($this->path, '/^javascript-/'); ksort($all_files); $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.')); // Check the first file. $file = reset($all_files); - $this->assertEqual(key($all_files), $file->filename, t('Correct array key was used for the first returned file.')); - $this->assertEqual($file->filename, $this->path . '/javascript-1.txt', t('First file name was set correctly.')); - $this->assertEqual($file->basename, 'javascript-1.txt', t('First basename was set correctly')); + $this->assertEqual(key($all_files), $file->filepath, t('Correct array key was used for the first returned file.')); + $this->assertEqual($file->filepath, $this->path . '/javascript-1.txt', t('First file name was set correctly.')); + $this->assertEqual($file->filename, 'javascript-1.txt', t('First basename was set correctly')); $this->assertEqual($file->name, 'javascript-1', t('First name was set correctly.')); // Check the second file. $file = next($all_files); - $this->assertEqual(key($all_files), $file->filename, t('Correct array key was used for the second returned file.')); - $this->assertEqual($file->filename, $this->path . '/javascript-2.script', t('Second file name was set correctly.')); - $this->assertEqual($file->basename, 'javascript-2.script', t('Second basename was set correctly')); + $this->assertEqual(key($all_files), $file->filepath, t('Correct array key was used for the second returned file.')); + $this->assertEqual($file->filepath, $this->path . '/javascript-2.script', t('Second file name was set correctly.')); + $this->assertEqual($file->filename, 'javascript-2.script', t('Second basename was set correctly')); $this->assertEqual($file->name, 'javascript-2', t('Second name was set correctly.')); } /** * Check that the callback function is called correctly. */ function testOptionCallback() { // When nothing is matched nothing should be passed to the callback. $all_files = file_scan_directory($this->path, '/^NONEXISTINGFILENAME/', array('callback' => 'file_test_file_scan_callback')); @@ -873,25 +873,25 @@ class FileScanDirectoryTest extends File $this->assertEqual(1, count($filtered_files), t('Filtered correctly.')); } /** * Check that key parameter sets the return value's key. */ function testOptionKey() { // "filename", for the path starting with $dir. $expected = array($this->path . '/javascript-1.txt', $this->path . '/javascript-2.script'); - $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filename'))); + $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filepath'))); sort($actual); $this->assertEqual($expected, $actual, t('Returned the correct values for the filename key.')); // "basename", for the basename of the file. $expected = array('javascript-1.txt', 'javascript-2.script'); - $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'basename'))); + $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filename'))); sort($actual); $this->assertEqual($expected, $actual, t('Returned the correct values for the basename key.')); // "name" for the name of the file without an extension. $expected = array('javascript-1', 'javascript-2'); $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'name'))); sort($actual); $this->assertEqual($expected, $actual, t('Returned the correct values for the name key.')); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.667 diff -u -9 -p -r1.667 system.module --- modules/system/system.module 11 Feb 2009 05:33:18 -0000 1.667 +++ modules/system/system.module 22 Feb 2009 13:02:26 -0000 @@ -1056,19 +1056,20 @@ function system_check_directory($form_el * An array of files to check. * @param $type * The type of the files. */ function system_get_files_database(&$files, $type) { // Extract current files from database. $result = db_query("SELECT filename, name, type, status, schema_version, weight FROM {system} WHERE type = '%s'", $type); while ($file = db_fetch_object($result)) { if (isset($files[$file->name]) && is_object($files[$file->name])) { - $file->old_filename = $file->filename; + $file->filepath = $file->filename; + $file->old_filepath = $file->filepath; foreach ($file as $key => $value) { if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) { $files[$file->name]->$key = $value; } } } } } @@ -1149,61 +1150,62 @@ function _system_theme_data() { $themes = drupal_system_listing('/\.info$/', 'themes'); // Find theme engines $engines = drupal_system_listing('/\.engine$/', 'themes/engines'); $defaults = system_theme_default(); $sub_themes = array(); // Read info files for each theme foreach ($themes as $key => $theme) { - $themes[$key]->info = drupal_parse_info_file($theme->filename) + $defaults; + $themes[$key]->filename = $theme->filepath; + $themes[$key]->info = drupal_parse_info_file($theme->filepath) + $defaults; // Invoke hook_system_info_alter() to give installed modules a chance to // modify the data in the .info files if necessary. drupal_alter('system_info', $themes[$key]->info, $themes[$key]); if (!empty($themes[$key]->info['base theme'])) { $sub_themes[] = $key; } if (empty($themes[$key]->info['engine'])) { - $filename = dirname($themes[$key]->filename) . '/' . $themes[$key]->name . '.theme'; + $filename = dirname($themes[$key]->filepath) . '/' . $themes[$key]->name . '.theme'; if (file_exists($filename)) { $themes[$key]->owner = $filename; $themes[$key]->prefix = $key; } } else { $engine = $themes[$key]->info['engine']; if (isset($engines[$engine])) { - $themes[$key]->owner = $engines[$engine]->filename; + $themes[$key]->owner = $engines[$engine]->filepath; $themes[$key]->prefix = $engines[$engine]->name; $themes[$key]->template = TRUE; } } // Give the stylesheets proper path information. $pathed_stylesheets = array(); foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) { foreach ($stylesheets as $stylesheet) { - $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filename) . '/' . $stylesheet; + $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filepath) . '/' . $stylesheet; } } $themes[$key]->info['stylesheets'] = $pathed_stylesheets; // Give the scripts proper path information. $scripts = array(); foreach ($themes[$key]->info['scripts'] as $script) { - $scripts[$script] = dirname($themes[$key]->filename) . '/' . $script; + $scripts[$script] = dirname($themes[$key]->filepath) . '/' . $script; } $themes[$key]->info['scripts'] = $scripts; // Give the screenshot proper path information. if (!empty($themes[$key]->info['screenshot'])) { - $themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) . '/' . $themes[$key]->info['screenshot']; + $themes[$key]->info['screenshot'] = dirname($themes[$key]->filepath) . '/' . $themes[$key]->info['screenshot']; } } // Now that we've established all our master themes, go back and fill in // data for subthemes. foreach ($sub_themes as $key) { $base_key = system_find_base_theme($themes, $key); if (!$base_key) { continue; Index: modules/update/update.compare.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.compare.inc,v retrieving revision 1.15 diff -u -9 -p -r1.15 update.compare.inc --- modules/update/update.compare.inc 20 Dec 2008 18:24:40 -0000 1.15 +++ modules/update/update.compare.inc 22 Feb 2009 13:02:26 -0000 @@ -63,19 +63,19 @@ function _update_process_info_list(&$pro // If we don't already know it, grab the change time on the .info file // itself. Note: we need to use the ctime, not the mtime (modification // time) since many (all?) tar implementations will go out of their way to // set the mtime on the files it creates to the timestamps recorded in the // tarball. We want to see the last time the file was changed on disk, // which is left alone by tar and correctly set to the time the .info file // was unpacked. if (!isset($file->info['_info_file_ctime'])) { - $info_filename = dirname($file->filename) . '/' . $file->name . '.info'; + $info_filename = dirname($file->filepath) . '/' . $file->name . '.info'; $file->info['_info_file_ctime'] = filectime($info_filename); } $project_name = $file->info['project']; if (!isset($projects[$project_name])) { // Only process this if we haven't done this project, since a single // project can have multiple modules or themes. $projects[$project_name] = array( 'name' => $project_name, Index: modules/upload/upload.test =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.test,v retrieving revision 1.12 diff -u -9 -p -r1.12 upload.test --- modules/upload/upload.test 27 Jan 2009 00:22:27 -0000 1.12 +++ modules/upload/upload.test 22 Feb 2009 13:02:26 -0000 @@ -33,19 +33,19 @@ class UploadTestCase extends DrupalWebTe $this->drupalPost('admin/settings/uploads', $edit, t('Save configuration')); $this->assertText('The configuration options have been saved.', 'Upload setting saved.'); $this->drupalLogout(); $this->drupalLogin($web_user); // Create a node and attempt to attach files. $node = $this->drupalCreateNode(); $text_files = $this->drupalGetTestFiles('text'); - $files = array(current($text_files)->filename, next($text_files)->filename); + $files = array(current($text_files)->filepath, next($text_files)->filepath); $this->uploadFile($node, $files[0]); $this->uploadFile($node, $files[1]); // Check to see that uploaded file is listed in detail page and actually accessible. $this->assertText(basename($files[0]), basename($files[0]) . ' found on node.'); $this->assertText(basename($files[1]), basename($files[1]) . ' found on node.'); $this->checkUploadedFile(basename($files[0])); @@ -102,39 +102,39 @@ class UploadTestCase extends DrupalWebTe $this->drupalLogin($web_user); $node = $this->drupalCreateNode(); // Attempt to upload .txt file when .html is only extension allowed. $text_file = current($this->drupalGetTestFiles('text')); // Select a file that's less than the 1MB upload limit so we only test one // limit at a time. - $this->uploadFile($node, $text_file->filename, FALSE); + $this->uploadFile($node, $text_file->filepath, FALSE); // Test the error message in two steps in case there are additional errors // that change the error message's format. - $this->assertRaw(t('The specified file %name could not be uploaded.', array('%name' => $text_file->basename)), t('File %filename was not allowed to be uploaded', array('%filename' => $text_file->filename))); + $this->assertRaw(t('The specified file %name could not be uploaded.', array('%name' => $text_file->filename)), t('File %filepath was not allowed to be uploaded', array('%filepath' => $text_file->filepath))); $this->assertRaw(t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $settings['upload_extensions'])), t('File extension cited as reason for failure')); // Attempt to upload .html file when .html is only extension allowed. $html_files = array_values($this->drupalGetTestFiles('html')); // Use the HTML file with the .html extension, $html_files[0] has a .txt // extension. - $html_file = $html_files[1]->filename; + $html_file = $html_files[1]->filepath; $this->uploadFile($node, $html_file); $this->assertNoRaw(t('The specified file %name could not be uploaded.', array('%name' => basename($html_file))), t('File '. $html_file . ' was allowed to be uploaded')); } /** * Attempt to upload a file that is larger than the maxsize and see that it fails. */ function testLimit() { $files = $this->drupalGetTestFiles('text', 1310720); // 1 MB. - $file = current($files)->filename; + $file = current($files)->filepath; $admin_user = $this->drupalCreateUser(array('administer site configuration')); $web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files')); $this->drupalLogin($admin_user); // Setup upload settings. $settings = array(); $settings['upload_list'] = '1'; // Yes. Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.28 diff -u -9 -p -r1.28 user.test --- modules/user/user.test 9 Feb 2009 07:36:15 -0000 1.28 +++ modules/user/user.test 22 Feb 2009 13:02:26 -0000 @@ -529,19 +529,19 @@ class UserPictureTestCase extends Drupal * * results: The image should be uploaded because ImageGDToolkit resizes the picture */ function testWithGDinvalidDimension() { if ($this->_directory_test) if (image_get_toolkit()) { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: invalid dimensions, valid filesize (0 = no limit). $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10); variable_set('user_picture_dimensions', $test_dim); variable_set('user_picture_file_size', 0); $pic_path = $this->saveUserPicture($image); // Check that the image was resized and is being displayed on the // user's profile page. @@ -563,32 +563,32 @@ class UserPictureTestCase extends Drupal * results: The image should be uploaded because ImageGDToolkit resizes the picture */ function testWithGDinvalidSize() { if ($this->_directory_test) if (image_get_toolkit()) { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: valid dimensions, invalid filesize. $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); $test_size = 1; variable_set('user_picture_dimensions', $test_dim); variable_set('user_picture_file_size', $test_size); $pic_path = $this->saveUserPicture($image); // Test that the upload failed and that the correct reason was cited. - $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->basename)); + $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename)); $this->assertRaw($text, t('Upload failed.')); - $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filename)), '%maxsize' => format_size($test_size * 1024))); + $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filepath)), '%maxsize' => format_size($test_size * 1024))); $this->assertRaw($text, t('File size cited as reason for failure.')); // Check if file is not uploaded. $this->assertFalse(is_file($pic_path), t('File was not uploaded.')); } } /** * Do the test: @@ -598,29 +598,29 @@ class UserPictureTestCase extends Drupal * results: The image shouldn't be uploaded */ function testWithoutGDinvalidDimension() { if ($this->_directory_test) if (!image_get_toolkit()) { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: invalid dimensions, valid filesize (0 = no limit). $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10); variable_set('user_picture_dimensions', $test_dim); variable_set('user_picture_file_size', 0); $pic_path = $this->saveUserPicture($image); // Test that the upload failed and that the correct reason was cited. - $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->basename)); + $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename)); $this->assertRaw($text, t('Upload failed.')); $text = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $test_dim)); $this->assertRaw($text, t('Checking response on invalid image (dimensions).')); // Check if file is not uploaded. $this->assertFalse(is_file($pic_path), t('File was not uploaded.')); } } @@ -631,73 +631,73 @@ class UserPictureTestCase extends Drupal * * results: The image shouldn't be uploaded */ function testWithoutGDinvalidSize() { if ($this->_directory_test) if (!image_get_toolkit()) { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: valid dimensions, invalid filesize. $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); $test_size = 1; variable_set('user_picture_dimensions', $test_dim); variable_set('user_picture_file_size', $test_size); $pic_path = $this->saveUserPicture($image); // Test that the upload failed and that the correct reason was cited. - $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->basename)); + $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename)); $this->assertRaw($text, t('Upload failed.')); - $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filename)), '%maxsize' => format_size($test_size * 1024))); + $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filepath)), '%maxsize' => format_size($test_size * 1024))); $this->assertRaw($text, t('File size cited as reason for failure.')); // Check if file is not uploaded. $this->assertFalse(is_file($pic_path), t('File was not uploaded.')); } } /** * Do the test: * Picture is valid (proper size and dimension) * * results: The image should be uploaded */ function testPictureIsValid() { if ($this->_directory_test) { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: valid dimensions, valid filesize (0 = no limit). $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); variable_set('user_picture_dimensions', $test_dim); variable_set('user_picture_file_size', 0); $pic_path = $this->saveUserPicture($image); // Check if image is displayed in user's profile page. $this->drupalGet('user'); $this->assertRaw($pic_path, t("Image is displayed in user's profile page")); // Check if file is located in proper directory. $this->assertTrue(is_file($pic_path), t('File is located in proper directory')); } } function saveUserPicture($image) { - $edit = array('files[picture_upload]' => realpath($image->filename)); + $edit = array('files[picture_upload]' => realpath($image->filepath)); $this->drupalPost('user/' . $this->user->uid.'/edit', $edit, t('Save')); - $img_info = image_get_info($image->filename); + $img_info = image_get_info($image->filepath); $picture_dir = variable_get('user_picture_path', 'pictures'); $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $this->user->uid . '.' . $img_info['extension']; return $pic_path; } } class UserPermissionsTestCase extends DrupalWebTestCase {