Basic release
This commit is contained in:
		
							
								
								
									
										55
									
								
								modules/depency-checker/dependency-checker.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								modules/depency-checker/dependency-checker.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
<?php
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace BDP_LV_Sachsen\WordpressHelper\DependenCyChecker;
 | 
			
		||||
 | 
			
		||||
class DependencyChecker
 | 
			
		||||
{
 | 
			
		||||
    const depenedencies = ['pfadfinden-theme-updater' ];
 | 
			
		||||
 | 
			
		||||
    public static function init() : void
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
        foreach(self::depenedencies as $class) {
 | 
			
		||||
           $file = ABSPATH . '/wp-content/plugins/bdp-kompass/plugins/' . $class;
 | 
			
		||||
 | 
			
		||||
           system('cp -r ' . $file . '* ' . ABSPATH . 'wp-content/plugins/' . $class);
 | 
			
		||||
 | 
			
		||||
            $plugin = 'pfadfinden-theme-updater/pfadfinden-theme-updater.php';
 | 
			
		||||
            $pluginPath = ABSPATH . '/wp-content/plugins/' . $class . '/' . $class . '.php';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
           activate_plugin($pluginPath);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static function recursive_copy($source, $destination) {
 | 
			
		||||
    // Überprüfe, ob das Quellverzeichnis existiert
 | 
			
		||||
    if (!file_exists($source)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
// Erstelle das Zielpfad, wenn es nicht existiert
 | 
			
		||||
if (!is_dir($destination)) {
 | 
			
		||||
    mkdir($destination, 0755, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Durchlaufe alle Dateien und Unterverzeichnisse im Quellverzeichnis
 | 
			
		||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
 | 
			
		||||
 | 
			
		||||
foreach ($iterator as $item) {
 | 
			
		||||
    if ($item->isDir()) {
 | 
			
		||||
        // Wenn es ein Verzeichnis ist, erstelle es im Zielverzeichnis
 | 
			
		||||
        mkdir($destination . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
 | 
			
		||||
    } else {
 | 
			
		||||
        // Wenn es eine Datei ist, kopiere sie in das Zielverzeichnis
 | 
			
		||||
        copy($item, $destination . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user