PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.1.2
Fluent Support – Helpdesk & Customer Support Ticket System v2.1.2
2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 All 67 releases
fluent-support / app / ComposerScript.php

ComposerScript.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.1.2, at app/ComposerScript.php

48 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App;
4
5 use Composer\Script\Event;
6 use InvalidArgumentException;
7 use RecursiveIteratorIterator;
8 use RecursiveDirectoryIterator;
9
10 class ComposerScript
11 {
12 public static function postInstall(Event $event)
13 {
14 static::postUpdate($event);
15 }
16
17 public static function postUpdate(Event $event)
18 {
19 $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
20 $composerJson = json_decode(file_get_contents($vendorDir . '/../composer.json'), true);
21 $namespace = $composerJson['extra']['wpfluent']['namespace']['current'];
22
23 if (!$namespace) {
24 throw new InvalidArgumentException("Namespace not set in composer.json file.");
25 }
26
27 $itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(
28 $vendorDir.'/wpfluent/framework/src/', RecursiveDirectoryIterator::SKIP_DOTS
29 ), RecursiveIteratorIterator::SELF_FIRST);
30
31 foreach ($itr as $file) {
32 if ($file->isDir()) {
33 continue;
34 }
35
36 $fileName = $file->getPathname();
37
38 $content = file_get_contents($fileName);
39 $content = str_replace(
40 'WPFluent\\',
41 $namespace . '\\Framework\\',
42 $content
43 );
44
45 file_put_contents($fileName, $content);
46 }
47 }
48 }