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
7bc9fa76
Commit
7bc9fa76
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
optimizations for updateApps
parent
f74d11c0
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/app.php
+21
-8
21 additions, 8 deletions
lib/app.php
lib/installer.php
+2
-2
2 additions, 2 deletions
lib/installer.php
with
23 additions
and
10 deletions
lib/app.php
+
21
−
8
View file @
7bc9fa76
...
...
@@ -265,19 +265,20 @@ class OC_App{
/**
* @brief Read app metadata from the info.xml file
* @param string $appid id of the app or the path of the info.xml file
* @param boolean path (optional)
* @returns array
*/
public
static
function
getAppInfo
(
$appid
){
if
(
is_file
(
$appid
)
){
public
static
function
getAppInfo
(
$appid
,
$path
=
false
){
if
(
$path
){
$file
=
$appid
;
}
else
{
$file
=
OC
::
$APPSROOT
.
'/apps/'
.
$appid
.
'/appinfo/info.xml'
;
if
(
!
is_file
(
$file
)){
return
array
();
}
}
$data
=
array
();
$content
=
file_get_contents
(
$file
);
if
(
!
$content
){
return
;
}
$xml
=
new
SimpleXMLElement
(
$content
);
$data
[
'info'
]
=
array
();
foreach
(
$xml
->
children
()
as
$child
){
...
...
@@ -381,9 +382,8 @@ class OC_App{
*/
public
static
function
updateApps
(){
// The rest comes here
$apps
=
OC_Appconfig
::
getApps
();
foreach
(
$apps
as
$app
){
$installedVersion
=
OC_Appconfig
::
getValue
(
$app
,
'installed_version'
);
$versions
=
self
::
getAppVersions
();
foreach
(
$versions
as
$app
=>
$installedVersion
){
$appInfo
=
OC_App
::
getAppInfo
(
$app
);
if
(
isset
(
$appInfo
[
'version'
]))
{
$currentVersion
=
$appInfo
[
'version'
];
...
...
@@ -395,6 +395,19 @@ class OC_App{
}
}
/**
* get the installed version of all papps
*/
public
static
function
getAppVersions
(){
$versions
=
array
();
$query
=
OC_DB
::
prepare
(
'SELECT appid, configvalue FROM *PREFIX*appconfig WHERE configkey = "installed_version"'
);
$result
=
$query
->
execute
();
while
(
$row
=
$result
->
fetchRow
()){
$versions
[
$row
[
'appid'
]]
=
$row
[
'configvalue'
];
}
return
$versions
;
}
/**
* update the database for the app and call the update script
* @param string appid
...
...
This diff is collapsed.
Click to expand it.
lib/installer.php
+
2
−
2
View file @
7bc9fa76
...
...
@@ -123,7 +123,7 @@ class OC_Installer{
}
return
false
;
}
$info
=
OC_App
::
getAppInfo
(
$extractDir
.
'/appinfo/info.xml'
);
$info
=
OC_App
::
getAppInfo
(
$extractDir
.
'/appinfo/info.xml'
,
true
);
$basedir
=
OC
::
$APPSROOT
.
'/apps/'
.
$info
[
'id'
];
//check if an app with the same id is already installed
...
...
@@ -296,7 +296,7 @@ class OC_Installer{
if
(
is_file
(
OC
::
$APPSROOT
.
"/apps/
$app
/appinfo/install.php"
)){
include
(
OC
::
$APPSROOT
.
"/apps/
$app
/appinfo/install.php"
);
}
$info
=
OC_App
::
getAppInfo
(
OC
::
$APPSROOT
.
"/apps/
$app
/appinfo/info.xml"
);
$info
=
OC_App
::
getAppInfo
(
$app
);
OC_Appconfig
::
setValue
(
$app
,
'installed_version'
,
$info
[
'version'
]);
return
$info
;
}
...
...
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