Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
4608f8a3
Commit
4608f8a3
authored
10 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
Throw an exception when we try to load an app that needs to be upgraded
parent
43d79023
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/app.php
+4
-34
4 additions, 34 deletions
lib/private/app.php
lib/private/needsupdateexception.php
+12
-0
12 additions, 0 deletions
lib/private/needsupdateexception.php
lib/private/serviceunavailableexception.php
+12
-0
12 additions, 0 deletions
lib/private/serviceunavailableexception.php
with
28 additions
and
34 deletions
lib/private/app.php
+
4
−
34
View file @
4608f8a3
...
...
@@ -81,10 +81,13 @@ class OC_App {
* load a single app
*
* @param string $app
* @throws \OC\NeedsUpdateException
*/
public
static
function
loadApp
(
$app
)
{
if
(
is_file
(
self
::
getAppPath
(
$app
)
.
'/appinfo/app.php'
))
{
self
::
checkUpgrade
(
$app
);
if
(
self
::
shouldUpgrade
(
$app
))
{
throw
new
\OC\NeedsUpdateException
();
}
require_once
$app
.
'/appinfo/app.php'
;
}
}
...
...
@@ -954,39 +957,6 @@ class OC_App {
return
false
;
}
/**
* check if the app needs updating and update when needed
*
* @param string $app
*/
public
static
function
checkUpgrade
(
$app
)
{
if
(
in_array
(
$app
,
self
::
$checkedApps
))
{
return
;
}
self
::
$checkedApps
[]
=
$app
;
if
(
!
self
::
shouldUpgrade
(
$app
))
{
return
;
}
$versions
=
self
::
getAppVersions
();
$installedVersion
=
$versions
[
$app
];
$currentVersion
=
OC_App
::
getAppVersion
(
$app
);
OC_Log
::
write
(
$app
,
'starting app upgrade from '
.
$installedVersion
.
' to '
.
$currentVersion
,
OC_Log
::
DEBUG
);
$info
=
self
::
getAppInfo
(
$app
);
try
{
OC_App
::
updateApp
(
$app
);
OC_Hook
::
emit
(
'update'
,
'success'
,
'Updated '
.
$info
[
'name'
]
.
' app'
);
}
catch
(
Exception
$e
)
{
OC_Hook
::
emit
(
'update'
,
'failure'
,
'Failed to update '
.
$info
[
'name'
]
.
' app: '
.
$e
->
getMessage
());
$l
=
OC_L10N
::
get
(
'lib'
);
throw
new
RuntimeException
(
$l
->
t
(
'Failed to upgrade "%s".'
,
array
(
$app
)),
0
,
$e
);
}
OC_Appconfig
::
setValue
(
$app
,
'installed_version'
,
OC_App
::
getAppVersion
(
$app
));
}
/**
* check if the current enabled apps are compatible with the current
* ownCloud version. disable them if not.
...
...
This diff is collapsed.
Click to expand it.
lib/private/needsupdateexception.php
0 → 100644
+
12
−
0
View file @
4608f8a3
<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace
OC
;
class
NeedsUpdateException
extends
ServiceUnavailableException
{
}
This diff is collapsed.
Click to expand it.
lib/private/serviceunavailableexception.php
0 → 100644
+
12
−
0
View file @
4608f8a3
<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace
OC
;
class
ServiceUnavailableException
extends
\Exception
{
}
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