PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 1.12
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v1.12
2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 1.45 All 41 releases
fluent-boards / app / ComposerScript.php

ComposerScript.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration 1.12, at app/ComposerScript.php

49 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 FluentBoards\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 }
49