By br0ken on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
7.x-2.x
Introduced in version:
7.x-2.x-dev
Description:
Upgrade path
- Ensure none of the removed functions are used within your codebase.
- Download 2.x version of the module
- Remove old version and replace it with newly downloaded
- Run
drush autoload-rebuildanddrush cc all
Removed functions
autoload_paths()autoload_paths_recompute()autoload_seek_classes()autoload_namespace_to_path()autoload_path_to_namespace()
New functions
autoload()- returns theAutoloadCacheobject which implements\Countable,\ArrayAccessand\Iteratorinterfaces.
How to replace the autoload_seek_classes()?
It's easier than you may think.
$modules = module_list();
$plugins = [];
foreach (autoload() as $namespace => $data) {
if (
// Class provider enabled.
isset($modules[$data['provider']]) &&
// Class implements required interface.
is_subclass_of($namespace, 'YOUR_BASE_CLASS_OR_INTERFACE') &&
// Class not abstract.
(new \ReflectionClass($namespace))->isInstantiable()
) {
$plugins[$namespace] = $data + [
'implements' => class_implements($namespace),
];
}
}
Impacts:
Module developers