Elgg  Version 3.0
PostInstall.php
Go to the documentation of this file.
1 <?php
2 namespace Elgg\Composer;
3 
5 use Elgg;
7 
11 class PostInstall {
19  public static function execute(Event $event) {
20  self::copyFromElggToRoot("install/config/htaccess.dist", ".htaccess");
21  self::copyFromElggToRoot("index.php", "index.php");
22  self::copyFromElggToRoot("install.php", "install.php");
23  self::copyFromElggToRoot("upgrade.php", "upgrade.php");
24 
25  $managed_plugins = [
26  'activity',
27  'blog',
28  'bookmarks',
29  'ckeditor',
30  'custom_index',
31  'dashboard',
32  'developers',
33  'diagnostics',
34  'discussions',
35  'embed',
36  'externalpages',
37  'file',
38  'friends',
39  'friends_collections',
40  'garbagecollector',
41  'groups',
42  'invitefriends',
43  'likes',
44  'members',
45  'messageboard',
46  'messages',
47  'notifications',
48  'pages',
49  'profile',
50  'reportedcontent',
51  'search',
52  'site_notifications',
53  'system_log',
54  'tagcloud',
55  'thewire',
56  'uservalidationbyemail',
57  'web_services',
58  ];
59 
60  foreach ($managed_plugins as $plugin) {
61  self::symlinkPluginFromRootToElgg($plugin);
62  }
63  }
64 
74  private static function copyFromElggToRoot($elggPath, $rootPath, $overwrite = false) {
75  $from = Elgg\Application::elggDir()->getPath($elggPath);
76  $to = Directory\Local::projectRoot()->getPath($rootPath);
77 
78  if (!$overwrite && file_exists($to)) {
79  return false;
80  }
81 
82  return copy($from, $to);
83  }
84 
93  private static function symlinkPluginFromRootToElgg($plugin) {
94  $from = Directory\Local::projectRoot()->getPath("mod/$plugin");
95  $to = Elgg\Application::elggDir()->getPath("mod/$plugin");
96 
97  return !file_exists($from) && symlink($to, $from);
98  }
99 }
$plugin
Configuration exception.
Models an event passed to event handlers.
Definition: Event.php:11
A composer command handler to run after composer install.
Definition: PostInstall.php:11
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy
Definition: LICENSE.txt:140
static elggDir()
Returns a directory that points to the root of Elgg, but not necessarily the install root...
static execute(Event $event)
Copies files that Elgg expects to be in the root directory.
Definition: PostInstall.php:19