Elgg
Version 2.3
engine
classes
Elgg
Composer
PostInstall.php
Go to the documentation of this file.
1
<?php
2
namespace
Elgg\Composer
;
3
4
use Composer\Script\Event;
5
use
Elgg
;
6
use
Elgg\Filesystem\Directory
;
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
}
Elgg\Application\elggDir
static elggDir()
Returns a directory that points to the root of Elgg, but not necessarily the install root.
Definition:
Application.php:472
Elgg\Composer\PostInstall
A composer command handler to run after composer install.
Definition:
PostInstall.php:11
Elgg\Composer\PostInstall\execute
static execute(Event $event)
Copies files that Elgg expects to be in the root directory.
Definition:
PostInstall.php:19
Elgg\Composer
Definition:
PostInstall.php:2
Elgg\Filesystem\Directory
Definition:
Fly.php:2
Elgg
Save menu items.
$plugin
$plugin
Definition:
set_priority.php:19
Generated on Fri Aug 29 2025 00:00:46 for Elgg by
1.9.1