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
8c820982
Commit
8c820982
authored
10 years ago
by
Vincent Petry
Browse files
Options
Downloads
Plain Diff
Merge pull request #8974 from owncloud/router-preventloadappsonupgrade
Prevent loadApps on upgrade
parents
4d216e8e
79920548
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/base.php
+6
-12
6 additions, 12 deletions
lib/base.php
lib/private/route/router.php
+3
-1
3 additions, 1 deletion
lib/private/route/router.php
lib/private/util.php
+16
-1
16 additions, 1 deletion
lib/private/util.php
lib/public/util.php
+9
-0
9 additions, 0 deletions
lib/public/util.php
with
34 additions
and
14 deletions
lib/base.php
+
6
−
12
View file @
8c820982
...
@@ -262,15 +262,10 @@ class OC {
...
@@ -262,15 +262,10 @@ class OC {
* check if the instance needs to preform an upgrade
* check if the instance needs to preform an upgrade
*
*
* @return bool
* @return bool
* @deprecated use \OCP\Util::needUpgrade instead
*/
*/
public
static
function
needUpgrade
()
{
public
static
function
needUpgrade
()
{
if
(
OC_Config
::
getValue
(
'installed'
,
false
))
{
return
\OCP\Util
::
needUpgrade
();
$installedVersion
=
OC_Config
::
getValue
(
'version'
,
'0.0.0'
);
$currentVersion
=
implode
(
'.'
,
OC_Util
::
getVersion
());
return
version_compare
(
$currentVersion
,
$installedVersion
,
'>'
);
}
else
{
return
false
;
}
}
}
/**
/**
...
@@ -279,7 +274,7 @@ class OC {
...
@@ -279,7 +274,7 @@ class OC {
* @return bool|void
* @return bool|void
*/
*/
public
static
function
checkUpgrade
(
$showTemplate
=
true
)
{
public
static
function
checkUpgrade
(
$showTemplate
=
true
)
{
if
(
self
::
needUpgrade
())
{
if
(
\OCP\Util
::
needUpgrade
())
{
if
(
$showTemplate
&&
!
OC_Config
::
getValue
(
'maintenance'
,
false
))
{
if
(
$showTemplate
&&
!
OC_Config
::
getValue
(
'maintenance'
,
false
))
{
$version
=
OC_Util
::
getVersion
();
$version
=
OC_Util
::
getVersion
();
$oldTheme
=
OC_Config
::
getValue
(
'theme'
);
$oldTheme
=
OC_Config
::
getValue
(
'theme'
);
...
@@ -595,7 +590,7 @@ class OC {
...
@@ -595,7 +590,7 @@ class OC {
* register hooks for the cache
* register hooks for the cache
*/
*/
public
static
function
registerCacheHooks
()
{
public
static
function
registerCacheHooks
()
{
if
(
OC_Config
::
getValue
(
'installed'
,
false
)
&&
!
self
::
needUpgrade
())
{
//don't try to do this before we are properly setup
if
(
OC_Config
::
getValue
(
'installed'
,
false
)
&&
!
\OCP\Util
::
needUpgrade
())
{
//don't try to do this before we are properly setup
\OCP\BackgroundJob
::
registerJob
(
'OC\Cache\FileGlobalGC'
);
\OCP\BackgroundJob
::
registerJob
(
'OC\Cache\FileGlobalGC'
);
// NOTE: This will be replaced to use OCP
// NOTE: This will be replaced to use OCP
...
@@ -608,7 +603,7 @@ class OC {
...
@@ -608,7 +603,7 @@ class OC {
* register hooks for the cache
* register hooks for the cache
*/
*/
public
static
function
registerLogRotate
()
{
public
static
function
registerLogRotate
()
{
if
(
OC_Config
::
getValue
(
'installed'
,
false
)
&&
OC_Config
::
getValue
(
'log_rotate_size'
,
false
)
&&
!
self
::
needUpgrade
())
{
if
(
OC_Config
::
getValue
(
'installed'
,
false
)
&&
OC_Config
::
getValue
(
'log_rotate_size'
,
false
)
&&
!
\OCP\Util
::
needUpgrade
())
{
//don't try to do this before we are properly setup
//don't try to do this before we are properly setup
//use custom logfile path if defined, otherwise use default of owncloud.log in data directory
//use custom logfile path if defined, otherwise use default of owncloud.log in data directory
\OCP\BackgroundJob
::
registerJob
(
'OC\Log\Rotate'
,
OC_Config
::
getValue
(
'logfile'
,
OC_Config
::
getValue
(
"datadirectory"
,
OC
::
$SERVERROOT
.
'/data'
)
.
'/owncloud.log'
));
\OCP\BackgroundJob
::
registerJob
(
'OC\Log\Rotate'
,
OC_Config
::
getValue
(
'logfile'
,
OC_Config
::
getValue
(
"datadirectory"
,
OC
::
$SERVERROOT
.
'/data'
)
.
'/owncloud.log'
));
...
@@ -695,10 +690,9 @@ class OC {
...
@@ -695,10 +690,9 @@ class OC {
if
(
!
self
::
$CLI
and
(
!
isset
(
$_GET
[
"logout"
])
or
(
$_GET
[
"logout"
]
!==
'true'
)))
{
if
(
!
self
::
$CLI
and
(
!
isset
(
$_GET
[
"logout"
])
or
(
$_GET
[
"logout"
]
!==
'true'
)))
{
try
{
try
{
if
(
!
OC_Config
::
getValue
(
'maintenance'
,
false
)
&&
!
self
::
needUpgrade
())
{
if
(
!
OC_Config
::
getValue
(
'maintenance'
,
false
)
&&
!
\OCP\Util
::
needUpgrade
())
{
OC_App
::
loadApps
(
array
(
'authentication'
));
OC_App
::
loadApps
(
array
(
'authentication'
));
OC_App
::
loadApps
(
array
(
'filesystem'
,
'logging'
));
OC_App
::
loadApps
(
array
(
'filesystem'
,
'logging'
));
OC_App
::
loadApps
();
}
}
self
::
checkSingleUserMode
();
self
::
checkSingleUserMode
();
OC
::
$server
->
getRouter
()
->
match
(
OC_Request
::
getRawPathInfo
());
OC
::
$server
->
getRouter
()
->
match
(
OC_Request
::
getRawPathInfo
());
...
...
This diff is collapsed.
Click to expand it.
lib/private/route/router.php
+
3
−
1
View file @
8c820982
...
@@ -192,7 +192,9 @@ class Router implements IRouter {
...
@@ -192,7 +192,9 @@ class Router implements IRouter {
$this
->
loadRoutes
(
$app
);
$this
->
loadRoutes
(
$app
);
}
else
if
(
substr
(
$url
,
0
,
6
)
===
'/core/'
or
substr
(
$url
,
0
,
10
)
===
'/settings/'
)
{
}
else
if
(
substr
(
$url
,
0
,
6
)
===
'/core/'
or
substr
(
$url
,
0
,
10
)
===
'/settings/'
)
{
\OC
::
$REQUESTEDAPP
=
$url
;
\OC
::
$REQUESTEDAPP
=
$url
;
\OC_App
::
loadApps
();
if
(
!
\OC_Config
::
getValue
(
'maintenance'
,
false
)
&&
!
\OCP\Util
::
needUpgrade
())
{
\OC_App
::
loadApps
();
}
$this
->
loadRoutes
(
'core'
);
$this
->
loadRoutes
(
'core'
);
}
else
{
}
else
{
$this
->
loadRoutes
();
$this
->
loadRoutes
();
...
...
This diff is collapsed.
Click to expand it.
lib/private/util.php
+
16
−
1
View file @
8c820982
...
@@ -329,7 +329,7 @@ class OC_Util {
...
@@ -329,7 +329,7 @@ class OC_Util {
$errors
=
array
();
$errors
=
array
();
$CONFIG_DATADIRECTORY
=
OC_Config
::
getValue
(
'datadirectory'
,
OC
::
$SERVERROOT
.
'/data'
);
$CONFIG_DATADIRECTORY
=
OC_Config
::
getValue
(
'datadirectory'
,
OC
::
$SERVERROOT
.
'/data'
);
if
(
!
\OC
::
needUpgrade
()
&&
OC_Config
::
getValue
(
'installed'
,
false
))
{
if
(
!
self
::
needUpgrade
()
&&
OC_Config
::
getValue
(
'installed'
,
false
))
{
// this check needs to be done every time
// this check needs to be done every time
$errors
=
self
::
checkDataDirectoryValidity
(
$CONFIG_DATADIRECTORY
);
$errors
=
self
::
checkDataDirectoryValidity
(
$CONFIG_DATADIRECTORY
);
}
}
...
@@ -1356,4 +1356,19 @@ class OC_Util {
...
@@ -1356,4 +1356,19 @@ class OC_Util {
}
}
return
true
;
return
true
;
}
}
/**
* Check whether the instance needs to preform an upgrade
*
* @return bool
*/
public
static
function
needUpgrade
()
{
if
(
OC_Config
::
getValue
(
'installed'
,
false
))
{
$installedVersion
=
OC_Config
::
getValue
(
'version'
,
'0.0.0'
);
$currentVersion
=
implode
(
'.'
,
OC_Util
::
getVersion
());
return
version_compare
(
$currentVersion
,
$installedVersion
,
'>'
);
}
else
{
return
false
;
}
}
}
}
This diff is collapsed.
Click to expand it.
lib/public/util.php
+
9
−
0
View file @
8c820982
...
@@ -516,4 +516,13 @@ class Util {
...
@@ -516,4 +516,13 @@ class Util {
public
static
function
isPublicLinkPasswordRequired
()
{
public
static
function
isPublicLinkPasswordRequired
()
{
return
\OC_Util
::
isPublicLinkPasswordRequired
();
return
\OC_Util
::
isPublicLinkPasswordRequired
();
}
}
/**
* Checks whether the current version needs upgrade.
*
* @return bool true if upgrade is needed, false otherwise
*/
public
static
function
needUpgrade
()
{
return
\OC_Util
::
needUpgrade
();
}
}
}
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