Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
ee247a21
Commit
ee247a21
authored
13 years ago
by
Kamil Domanski
Browse files
Options
Downloads
Patches
Plain Diff
shipped apps are no longer hardcoded
parent
37f9e037
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/installer.php
+9
-9
9 additions, 9 deletions
lib/installer.php
lib/setup.php
+30
-16
30 additions, 16 deletions
lib/setup.php
with
39 additions
and
25 deletions
lib/installer.php
+
9
−
9
View file @
ee247a21
...
@@ -108,7 +108,7 @@ class OC_INSTALLER{
...
@@ -108,7 +108,7 @@ class OC_INSTALLER{
$basedir
=
$SERVERROOT
.
'/apps/'
.
$info
[
'id'
];
$basedir
=
$SERVERROOT
.
'/apps/'
.
$info
[
'id'
];
//check if an app with the same id is already installed
//check if an app with the same id is already installed
if
(
self
::
isInstalled
(
$info
[
'id'
]
))
)
{
if
(
self
::
isInstalled
(
$info
[
'id'
]
)){
error_log
(
"App already installed"
);
error_log
(
"App already installed"
);
OC_HELPER
::
rmdirr
(
$extractDir
);
OC_HELPER
::
rmdirr
(
$extractDir
);
if
(
$data
[
'source'
]
==
'http'
){
if
(
$data
[
'source'
]
==
'http'
){
...
@@ -118,14 +118,14 @@ class OC_INSTALLER{
...
@@ -118,14 +118,14 @@ class OC_INSTALLER{
}
}
//check if the destination directory already exists
//check if the destination directory already exists
+
if
(
is_dir
(
$basedir
)){
if
(
is_dir
(
$basedir
)){
+
error_log
(
"App's directory already exists"
);
error_log
(
"App's directory already exists"
);
+
OC_HELPER
::
rmdirr
(
$extractDir
);
OC_HELPER
::
rmdirr
(
$extractDir
);
+
if
(
$data
[
'source'
]
==
'http'
){
if
(
$data
[
'source'
]
==
'http'
){
+
unlink
(
$path
);
unlink
(
$path
);
+
}
}
+
return
false
;
return
false
;
+
}
}
if
(
isset
(
$data
[
'pretent'
])
and
$data
[
'pretent'
]
==
true
){
if
(
isset
(
$data
[
'pretent'
])
and
$data
[
'pretent'
]
==
true
){
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
lib/setup.php
+
30
−
16
View file @
ee247a21
<?php
<?php
include_once
(
'installer.php'
);
$hasSQLite
=
(
is_callable
(
'sqlite_open'
)
or
class_exists
(
'SQLite3'
));
$hasSQLite
=
(
is_callable
(
'sqlite_open'
)
or
class_exists
(
'SQLite3'
));
$hasMySQL
=
is_callable
(
'mysql_connect'
);
$hasMySQL
=
is_callable
(
'mysql_connect'
);
$datadir
=
OC_CONFIG
::
getValue
(
'datadir'
,
$SERVERROOT
.
'/data'
);
$datadir
=
OC_CONFIG
::
getValue
(
'datadir'
,
$SERVERROOT
.
'/data'
);
...
@@ -31,7 +33,6 @@ else {
...
@@ -31,7 +33,6 @@ else {
class
OC_SETUP
{
class
OC_SETUP
{
public
static
function
install
(
$options
)
{
public
static
function
install
(
$options
)
{
global
$SERVERROOT
;
$error
=
array
();
$error
=
array
();
$dbtype
=
$options
[
'dbtype'
];
$dbtype
=
$options
[
'dbtype'
];
...
@@ -134,21 +135,8 @@ class OC_SETUP {
...
@@ -134,21 +135,8 @@ class OC_SETUP {
OC_GROUP
::
createGroup
(
'admin'
);
OC_GROUP
::
createGroup
(
'admin'
);
OC_GROUP
::
addToGroup
(
$username
,
'admin'
);
OC_GROUP
::
addToGroup
(
$username
,
'admin'
);
foreach
(
array
(
"files_imageviewer"
,
"files_publiclink"
)
as
$app
){
//guess what this does
self
::
installShippedApps
();
if
(
is_file
(
"
$SERVERROOT
/apps/
$app
/appinfo/database.xml"
)){
OC_DB
::
createDbFromStructure
(
"
$SERVERROOT
/apps/
$app
/appinfo/database.xml"
);
}
//run appinfo/install.php
if
(
is_file
(
"
$SERVERROOT
/apps/
$app
/appinfo/install.php"
)){
include
(
"
$SERVERROOT
/apps/
$app
/appinfo/install.php"
);
}
$info
=
OC_APP
::
getAppInfo
(
"
$SERVERROOT
/apps/
$app
/appinfo/info.xml"
);
OC_APPCONFIG
::
setValue
(
$app
,
'installed_version'
,
$info
[
'version'
]);
OC_APPCONFIG
::
setValue
(
$app
,
'enabled'
,
'yes'
);
}
//create htaccess files for apache hosts
//create htaccess files for apache hosts
self
::
createHtaccess
();
//TODO detect if apache is used
self
::
createHtaccess
();
//TODO detect if apache is used
...
@@ -198,6 +186,32 @@ class OC_SETUP {
...
@@ -198,6 +186,32 @@ class OC_SETUP {
$content
=
"deny from all"
;
$content
=
"deny from all"
;
file_put_contents
(
OC_CONFIG
::
getValue
(
'datadirectory'
,
$SERVERROOT
.
'/data'
)
.
'/.htaccess'
,
$content
);
file_put_contents
(
OC_CONFIG
::
getValue
(
'datadirectory'
,
$SERVERROOT
.
'/data'
)
.
'/.htaccess'
,
$content
);
}
}
private
static
function
installShippedApps
(){
global
$SERVERROOT
;
$dir
=
opendir
(
"
$SERVERROOT
/apps"
);
while
(
false
!==
(
$filename
=
readdir
(
$dir
))){
if
(
substr
(
$filename
,
0
,
1
)
!=
'.'
and
is_dir
(
"
$SERVERROOT
/apps/
$filename
"
)
){
if
(
file_exists
(
"
$SERVERROOT
/apps/
$filename
/appinfo/app.php"
)){
if
(
!
OC_INSTALLER
::
isInstalled
(
$filename
)){
//install the database
if
(
is_file
(
"
$SERVERROOT
/apps/
$filename
/appinfo/database.xml"
)){
OC_DB
::
createDbFromStructure
(
"
$SERVERROOT
/apps/
$filename
/appinfo/database.xml"
);
}
//run appinfo/install.php
if
(
is_file
(
"
$SERVERROOT
/apps/
$filename
/appinfo/install.php"
)){
include
(
"
$SERVERROOT
/apps/
$filename
/appinfo/install.php"
);
}
$info
=
OC_APP
::
getAppInfo
(
"
$SERVERROOT
/apps/
$filename
/appinfo/info.xml"
);
OC_APPCONFIG
::
setValue
(
$filename
,
'installed_version'
,
$info
[
'version'
]);
OC_APPCONFIG
::
setValue
(
$filename
,
'enabled'
,
'yes'
);
}
}
}
}
closedir
(
$dir
);
}
}
}
?>
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment