Elgg  Version 2.3
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  'aalborg_theme',
27  'blog',
28  'bookmarks',
29  'ckeditor',
30  'custom_index',
31  'dashboard',
32  'developers',
33  'diagnostics',
34  'discussions',
35  'embed',
36  'externalpages',
37  'file',
38  'garbagecollector',
39  'groups',
40  'htmlawed',
41  'invitefriends',
42  'legacy_urls',
43  'likes',
44  'logbrowser',
45  'logrotate',
46  'members',
47  'messageboard',
48  'messages',
49  'notifications',
50  'pages',
51  'profile',
52  'reportedcontent',
53  'search',
54  'site_notifications',
55  'tagcloud',
56  'thewire',
57  'twitter_api',
58  'uservalidationbyemail',
59  'web_services',
60  ];
61 
62  foreach ($managed_plugins as $plugin) {
63  self::symlinkPluginFromRootToElgg($plugin);
64  }
65  }
66 
76  private static function copyFromElggToRoot($elggPath, $rootPath, $overwrite = false) {
77  $from = Elgg\Application::elggDir()->getPath($elggPath);
78  $to = Directory\Local::root()->getPath($rootPath);
79 
80  if (!$overwrite && file_exists($to)) {
81  return false;
82  }
83 
84  return copy($from, $to);
85  }
86 
95  private static function symlinkPluginFromRootToElgg($plugin) {
96  $from = Directory\Local::root()->getPath("mod/$plugin");
97  $to = Elgg\Application::elggDir()->getPath("mod/$plugin");
98 
99  return !file_exists($from) && symlink($to, $from);
100  }
101 }
$plugin
Save menu items.
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: GPL-LICENSE.txt:87
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
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:5