Jump to content

Breaking changes in minor releases


Colonel_mortis

Recommended Posts

This change, made in 4.7.12, breaks applications that don't have an extensions.json or that haven't got all their extensions registered there. Any app that created extensions a while ago (and hasn't updated them recently?) will silently have stopped working.

diff --git a/system/Application/Application.php b/system/Application/Application.php
index 66c5fc8cd..854837fa7 100644
--- a/system/Application/Application.php
+++ b/system/Application/Application.php
@@ -786,7 +786,6 @@ public function extensions( $app, $extension, $construct=TRUE, $checkAccess=FALS
 		
 		$classes = array();
 		$jsonFile = $this->getApplicationPath() . "/data/extensions.json";
-		$directory = $this->getApplicationPath() . "/extensions/{$app}/{$extension}";
 				
 		/* New extensions.json based approach */
 		if ( file_exists( $jsonFile ) and $json = @json_decode( \file_get_contents( $jsonFile ), TRUE ) )
@@ -814,56 +813,6 @@ public function extensions( $app, $extension, $construct=TRUE, $checkAccess=FALS
 				}
 			}
 		}
-		
-		/* Legacy DirectoryIterator approach */
-		elseif ( is_dir( $directory ) )
-		{
-			$dir = new \DirectoryIterator( $directory );
-						
-			foreach ( $dir as $file )
-			{
-				/* Macs create copies of files with "._" prefix which breaks when we just load up all files in a dir, ignore those */
-				if ( !$file->isDir() and !$file->isDot() and mb_substr( $file, -4 ) === '.php' AND mb_substr( $file, 0, 2 ) != '._' )
-				{
-					$classname = 'IPS\\' . $this->directory . '\extensions\\' . $app . '\\' . $extension . '\\' . mb_substr( $file, 0, -4 );
-
-					/* Check if class exists - sometimes we have to use blank files to wipe out old extensions */
-					try
-					{
-						if( !class_exists( $classname ) )
-						{
-							continue;
-						}
-						
-						if ( method_exists( $classname, 'deprecated' ) )
-						{
-							continue;
-						}
-					}
-					catch( \ErrorException $e )
-					{
-						continue;
-					}
-					
-					if ( method_exists( $classname, 'generate' ) )
-					{
-						$classes = array_merge( $classes, $classname::generate() );
-					}
-					elseif ( !$construct )
-					{
-						$classes[ mb_substr( $file, 0, -4 ) ] = $classname;
-					}
-					else
-					{
-						try
-						{							
-							$classes[ mb_substr( $file, 0, -4 ) ] = new $classname( $checkAccess === TRUE ? \IPS\Member::loggedIn() : ( $checkAccess === FALSE ? NULL : $checkAccess ) );
-						}
-						catch( \RuntimeException $e ){}
-					}
-				}
-			}
-		}
 				
 		return $classes;
 	}

Aren't we past this yet...?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...