Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL-CMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yzha1
UNL-CMS
Commits
047afc99
Commit
047afc99
authored
12 years ago
by
Tim Steiner
Browse files
Options
Downloads
Patches
Plain Diff
[gh-471] Also handle migrated paths with query strings for HTML documents.
parent
7c3fc4a5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sites/all/modules/unl/unl_migration.php
+24
-19
24 additions, 19 deletions
sites/all/modules/unl/unl_migration.php
with
24 additions
and
19 deletions
sites/all/modules/unl/unl_migration.php
+
24
−
19
View file @
047afc99
...
...
@@ -655,36 +655,38 @@ class Unl_Migration_Tool
if
(
isset
(
$data
[
'lastModified'
]))
{
$this
->
_lastModifications
[
$path
]
=
$data
[
'lastModified'
];
}
if
(
strpos
(
$data
[
'contentType'
],
'html'
)
===
FALSE
)
{
if
(
!
$data
[
'contentType'
])
{
$this
->
_log
(
'The file type at '
.
$fullPath
.
' was not specified. Ignoring.'
,
WATCHDOG_ERROR
);
return
;
}
$file
Path
=
$path
;
$clean
Path
=
$path
;
$pathParts
=
parse_url
(
$path
);
// If the path contains a query, we'll have to change it.
if
(
array_key_exists
(
'query'
,
$pathParts
))
{
$matches
=
array
();
if
(
array_key_exists
(
'Content-Disposition'
,
$data
[
'headers'
])
&&
preg_match
(
'/filename="(.*)"/'
,
$data
[
'headers'
][
'Content-Disposition'
],
$matches
))
{
$file
Path
=
$pathParts
[
'path'
]
.
'/'
.
$matches
[
1
];
$clean
Path
=
$pathParts
[
'path'
]
.
'/'
.
$matches
[
1
];
}
else
{
$filePath
=
$pathParts
[
'path'
]
.
'/'
.
$pathParts
[
'query'
];
$cleanPath
=
$pathParts
[
'path'
]
.
'/'
.
$pathParts
[
'query'
];
}
$cleanPath
=
strtr
(
$cleanPath
,
array
(
'%2f'
=>
'/'
,
'%2F'
=>
'/'
));
}
if
(
strpos
(
$data
[
'contentType'
],
'html'
)
===
FALSE
)
{
if
(
!
$data
[
'contentType'
])
{
$this
->
_log
(
'The file type at '
.
$fullPath
.
' was not specified. Ignoring.'
,
WATCHDOG_ERROR
);
return
;
}
@
drupal_mkdir
(
'public://'
.
urldecode
(
dirname
(
$
file
Path
)),
NULL
,
TRUE
);
@
drupal_mkdir
(
'public://'
.
urldecode
(
dirname
(
$
clean
Path
)),
NULL
,
TRUE
);
if
(
!
mb_check_encoding
(
$path
,
'UTF-8'
))
{
$path
=
iconv
(
'ISO-8859-1'
,
'UTF-8'
,
$path
);
}
try
{
$file
=
file_save_data
(
$data
[
'content'
],
'public://'
.
urldecode
(
$
file
Path
),
FILE_EXISTS_REPLACE
);
$file
=
file_save_data
(
$data
[
'content'
],
'public://'
.
urldecode
(
$
clean
Path
),
FILE_EXISTS_REPLACE
);
}
catch
(
Exception
$e
)
{
$this
->
_log
(
'Could not migrate file "'
.
$path
.
'"! File name too long?'
,
WATCHDOG_ERROR
);
}
$this
->
_hrefTransformFiles
[
$path
]
=
$this
->
_makeRelativeUrl
(
file_create_url
(
'public://'
.
$
file
Path
));
$this
->
_hrefTransformFiles
[
$path
]
=
$this
->
_makeRelativeUrl
(
file_create_url
(
'public://'
.
$
clean
Path
));
return
;
}
$html
=
$data
[
'content'
];
...
...
@@ -793,8 +795,8 @@ class Unl_Migration_Tool
$this
->
_processLinks
(
$linkNode
->
getAttribute
(
'src'
),
$path
,
$page_base
);
}
$this
->
_content
[
$
p
ath
]
=
$maincontentarea
;
$this
->
_pageTitles
[
$
p
ath
]
=
$pageTitle
;
$this
->
_content
[
$
cleanP
ath
]
=
$maincontentarea
;
$this
->
_pageTitles
[
$
cleanP
ath
]
=
$pageTitle
;
// Scan the page for the parent breadcrumb
$breadcrumbs
=
$dom
->
getElementById
(
'breadcrumbs'
);
...
...
@@ -812,8 +814,11 @@ class Unl_Migration_Tool
if
(
$pageParentLink
==
$path
)
{
$pageParentLink
=
''
;
}
$this
->
_pageParentLinks
[
$path
]
=
$pageParentLink
;
$this
->
_pageParentLinks
[
$cleanPath
]
=
$pageParentLink
;
}
}
if
(
$cleanPath
!=
$path
)
{
$this
->
_hrefTransformFiles
[
$path
]
=
$cleanPath
;
}
}
...
...
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