Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
docker
osticket
Commits
293d845a
Commit
293d845a
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Add ability to switch to manual upgrade mode on ajax failure - 404 error.
parent
57c8fee1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/upgrader/upgrade.inc.php
+19
-5
19 additions, 5 deletions
include/upgrader/upgrade.inc.php
scp/js/upgrader.js
+28
-17
28 additions, 17 deletions
scp/js/upgrader.js
with
47 additions
and
22 deletions
include/upgrader/upgrade.inc.php
+
19
−
5
View file @
293d845a
<?php
if
(
!
defined
(
'OSTSCPINC'
)
||
!
$thisstaff
||
!
$thisstaff
->
isAdmin
())
die
(
'Access Denied'
);
//See if we need to switch the mode of upgrade...e.g from ajax (default) to manual
if
((
$mode
=
$ost
->
get_var
(
'm'
,
$_GET
))
&&
$mode
!=
$upgrader
->
getMode
())
{
//Set Persistent mode/
$upgrader
->
setMode
(
$mode
);
//Log warning about ajax calls - most likely culprit is AcceptPathInfo directive.
if
(
$mode
==
'manual'
)
$ost
->
logWarning
(
'Ajax calls are failing'
,
'Make sure your server has AcceptPathInfo directive set to "ON" or get technical help'
);
}
$action
=
$upgrader
->
getNextAction
();
?>
<h2>
osTicket Upgrade
</h2>
...
...
@@ -9,7 +20,7 @@ $action=$upgrader->getNextAction();
<p>
Thank you for taking the time to upgrade your osTicket intallation!
</p>
<p>
Please don't cancel or close the browser, any errors at this stage will be fatal.
</p>
</div>
<h2>
<?php
echo
$action
?>
</h2>
<h2
id=
"task"
>
<?php
echo
$action
?>
</h2>
<p>
The upgrade wizard will now attempt to upgrade your database and core settings!
</p>
<ul>
<li>
Database enhancements
</li>
...
...
@@ -20,8 +31,9 @@ $action=$upgrader->getNextAction();
<form
method=
"post"
action=
"upgrade.php"
id=
"upgrade"
>
<?php
csrf_token
();
?>
<input
type=
"hidden"
name=
"s"
value=
"upgrade"
>
<input
type=
"hidden"
id=
"mode"
name=
"m"
value=
"
<?php
echo
$upgrader
->
getMode
();
?>
"
>
<input
type=
"hidden"
name=
"sh"
value=
"
<?php
echo
$upgrader
->
getSchemaSignature
();
?>
"
>
<input
class=
"btn"
type=
"submit"
name=
"submit"
value=
"
Do It
Now!"
>
<input
class=
"btn"
type=
"submit"
name=
"submit"
value=
"
Upgrade
Now!"
>
</form>
</div>
</div>
...
...
@@ -33,9 +45,11 @@ $action=$upgrader->getNextAction();
</div>
<div
class=
"clear"
></div>
<div
id=
"upgrading"
>
<h4>
<?php
echo
$action
;
?>
</h4>
<h4
id=
"action"
>
<?php
echo
$action
;
?>
</h4>
Please wait... while we upgrade your osTicket installation!
<div
id=
"msg"
style=
"font-weight: bold;padding-top:10px;"
>
Smile!
</div>
<div
id=
"msg"
style=
"font-weight: bold;padding-top:10px;"
>
<?php
echo
sprintf
(
"%s - Relax!"
,
$thisstaff
->
getFirstName
());
?>
</div>
</div>
</div>
<div
class=
"clear"
></div>
`
<div
class=
"clear"
></div>
This diff is collapsed.
Click to expand it.
scp/js/upgrader.js
+
28
−
17
View file @
293d845a
jQuery
(
function
(
$
)
{
$
(
"
#overlay
"
).
css
({
opacity
:
0.3
,
top
:
0
,
...
...
@@ -12,18 +12,21 @@ jQuery(function($) {
top
:
(
$
(
window
).
height
()
/
3
),
left
:
(
$
(
window
).
width
()
/
2
-
160
)
});
$
(
'
form#upgrade
'
).
submit
(
function
(
e
)
{
e
.
preventDefault
();
var
form
=
$
(
this
);
$
(
'
input[type=submit]
'
,
this
).
attr
(
'
disabled
'
,
'
disabled
'
);
$
(
'
#overlay, #upgrading
'
).
show
();
doTasks
(
'
upgrade.php
'
,
form
.
serialize
());
return
false
;
});
if
(
$
(
'
input#mode
'
,
form
).
val
()
==
'
manual
'
)
{
return
true
;
}
else
{
e
.
preventDefault
();
autoUpgrade
(
'
upgrade.php
'
,
form
.
serialize
());
return
false
;
}
});
function
doTasks
(
url
,
data
)
{
function
autoUpgrade
(
url
,
data
)
{
function
_lp
(
count
)
{
$
.
ajax
({
type
:
'
POST
'
,
...
...
@@ -33,26 +36,34 @@ jQuery(function($) {
data
:
data
,
dataType
:
'
text
'
,
success
:
function
(
res
)
{
if
(
res
)
{
$
(
'
#lo
ading #
msg
'
).
html
(
res
);
}
$
(
'
#main #task
'
).
html
(
res
)
;
$
(
'
#upgr
ading #
action
'
).
html
(
res
);
$
(
'
#upgrading #msg
'
).
html
(
'
Still busy... smile #
'
+
count
);
},
statusCode
:
{
200
:
function
()
{
setTimeout
(
function
()
{
_lp
(
count
+
1
);
},
2
);
setTimeout
(
function
()
{
_lp
(
count
+
1
);
},
2
00
);
},
201
:
function
()
{
$
(
'
#
lo
ading #msg
'
).
html
(
"
We're done... c
leaning up!
"
);
$
(
'
#
upgr
ading #msg
'
).
html
(
"
C
leaning up!
...
"
);
setTimeout
(
function
()
{
location
.
href
=
url
+
'
?c=
'
+
count
+
'
&r=
'
+
Math
.
floor
((
Math
.
random
()
*
100
)
+
1
);
},
3000
);
}
},
error
:
function
()
{
$
(
'
#loading #msg
'
).
html
(
"
Something went wrong
"
);
setTimeout
(
function
()
{
location
.
href
=
url
+
'
?c=
'
+
count
+
'
&r=
'
+
Math
.
floor
((
Math
.
random
()
*
100
)
+
1
);
},
1000
);
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
$
(
'
#upgrading #action
'
).
html
(
'
Error occurred. Aborting...
'
);
switch
(
jqXHR
.
status
)
{
case
404
:
$
(
'
#upgrading #msg
'
).
html
(
"
Manual upgrade required (ajax failed)
"
);
setTimeout
(
function
()
{
location
.
href
=
url
+
'
?m=manual&c=
'
+
count
+
'
&r=
'
+
Math
.
floor
((
Math
.
random
()
*
100
)
+
1
);
},
2000
);
break
;
default
:
$
(
'
#upgrading #msg
'
).
html
(
"
Something went wrong
"
);
setTimeout
(
function
()
{
location
.
href
=
url
+
'
?c=
'
+
count
+
'
&r=
'
+
Math
.
floor
((
Math
.
random
()
*
100
)
+
1
);
},
2000
);
}
}
});
};
_lp
(
0
);
_lp
(
1
);
}
});
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