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
d9220f43
Commit
d9220f43
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Ignore/filter empty patches - glob in some platform return empty array instead of false.
parent
3dbddac0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.migrater.php
+13
-14
13 additions, 14 deletions
include/class.migrater.php
with
13 additions
and
14 deletions
include/class.migrater.php
+
13
−
14
View file @
d9220f43
...
...
@@ -3,7 +3,7 @@
class.migrater.php
Migration utils required by upgrader.
Jared Hancock <jared@osticket.com>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
...
...
@@ -34,11 +34,11 @@ class DatabaseMigrater {
var
$sqldir
;
function
DatabaseMigrater
(
$start
,
$end
,
$sqldir
)
{
$this
->
start
=
$start
;
$this
->
end
=
$end
;
$this
->
sqldir
=
$sqldir
;
}
function
getPatches
(
$stop
=
null
)
{
...
...
@@ -50,14 +50,13 @@ class DatabaseMigrater {
while
(
true
)
{
$next
=
glob
(
$this
->
sqldir
.
substr
(
$start
,
0
,
8
)
.
'-*.patch.sql'
);
if
(
count
(
$next
)
==
1
)
{
if
(
!
$next
||
empty
(
$next
))
{
# No patches leaving the current signature.
# Assume that we've applied all the available patches
break
;
}
elseif
(
count
(
$next
)
==
1
)
{
$patches
[]
=
$next
[
0
];
$start
=
substr
(
basename
(
$next
[
0
]),
9
,
8
);
}
elseif
(
count
(
$next
)
==
0
)
{
# There are no patches leaving the current signature. We
# have to assume that we've applied all the available
# patches.
break
;
}
else
{
# Problem -- more than one patch exists from this snapshot.
# We probably need a graph approach to solve this.
...
...
@@ -69,7 +68,7 @@ class DatabaseMigrater {
break
;
}
return
$patches
;
return
array_filter
(
$patches
)
;
}
}
...
...
@@ -159,7 +158,7 @@ class AttachmentMigrater {
}
# Get the mime/type of each file
# XXX: Use finfo_buffer for PHP 5.3+
if
(
function_exists
(
'mime_content_type'
))
{
if
(
function_exists
(
'mime_content_type'
))
{
//XXX: function depreciated in newer versions of PHP!!!!!
$info
[
'type'
]
=
mime_content_type
(
$info
[
'path'
]);
}
elseif
(
function_exists
(
'finfo_file'
))
{
// PHP 5.3.0+
...
...
@@ -193,7 +192,7 @@ class AttachmentMigrater {
/* static */
function
queueAttachments
(
$limit
=
0
){
global
$cfg
,
$ost
;
# Since the queue is persistent - we want to make sure we get to empty
# Since the queue is persistent - we want to make sure we get to empty
# before we find more attachments.
if
((
$qc
=
$this
->
getQueueLength
()))
return
$qc
;
...
...
@@ -231,9 +230,9 @@ class AttachmentMigrater {
);
$filename15
=
sprintf
(
"%s/%s_%s"
,
rtrim
(
$dir
,
'/'
),
$key
,
$name
);
$filename16
=
sprintf
(
"%s/%s/%s_%s"
,
rtrim
(
$dir
,
'/'
),
$month
,
$key
,
$name
);
//new destination.
if
(
file_exists
(
$filename15
))
{
if
(
file_exists
(
$filename15
))
{
$info
[
'path'
]
=
$filename15
;
}
elseif
(
file_exists
(
$filename16
))
{
}
elseif
(
file_exists
(
$filename16
))
{
$info
[
'path'
]
=
$filename16
;
}
else
{
# XXX Cannot find file for attachment
...
...
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