Bläddra i källkod

WIP fix document path BT#15056

Julio 6 år sedan
förälder
incheckning
d8f6d0e727
1 ändrade filer med 26 tillägg och 0 borttagningar
  1. 26 0
      tests/scripts/fix_documents_path.php

+ 26 - 0
tests/scripts/fix_documents_path.php

@@ -0,0 +1,26 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+exit;
+require_once __DIR__.'/../../main/inc/global.inc.php';
+
+$courses = CourseManager::get_courses_list();
+
+$pathToSearch = api_get_path(WEB_PATH).'../../../../../../../';
+$chamilo = VChamiloPlugin::create();
+$chamilo->getAdminUrl()
+$courseSysPath = api_get_path(SYS_COURSE_PATH);
+foreach ($courses as $course) {
+    $course['directory'] = 'FORMATIONSCHAMILO';
+    $docsPath = $courseSysPath.$course['directory'].'/document/';
+    $finder = new \Symfony\Component\Finder\Finder();
+    $finder->files()->in($docsPath)->name('*.html');
+
+    foreach ($finder as $file) {
+        echo $file->getRealPath().PHP_EOL;
+        $contents = file_get_contents($file->getRealPath());
+        echo $pathToSearch;
+        $newContent = str_replace($pathToSearch, 'courses', $contents);
+       // file_put_contents($file->getRealPath())
+    }exit;
+}