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
c7a4075a
Commit
c7a4075a
authored
12 years ago
by
Tom Needham
Browse files
Options
Downloads
Patches
Plain Diff
Updates contacts migration provider
parent
fa5b31ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/contacts/appinfo/migrate.php
+6
-4
6 additions, 4 deletions
apps/contacts/appinfo/migrate.php
with
6 additions
and
4 deletions
apps/contacts/appinfo/migrate.php
+
6
−
4
View file @
c7a4075a
...
@@ -30,7 +30,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
...
@@ -30,7 +30,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
}
}
// Import function for
bookmark
s
// Import function for
contact
s
function
import
(
){
function
import
(
){
switch
(
$this
->
appinfo
->
version
){
switch
(
$this
->
appinfo
->
version
){
default
:
default
:
...
@@ -39,11 +39,13 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
...
@@ -39,11 +39,13 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
$results
=
$query
->
execute
(
array
(
$this
->
olduid
)
);
$results
=
$query
->
execute
(
array
(
$this
->
olduid
)
);
$idmap
=
array
();
$idmap
=
array
();
while
(
$row
=
$results
->
fetchRow
()
){
while
(
$row
=
$results
->
fetchRow
()
){
// Import each
bookmark, saving its id into the map
// Import each
addressbook
$addressbookquery
=
OCP\DB
::
prepare
(
"INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)"
);
$addressbookquery
=
OCP\DB
::
prepare
(
"INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)"
);
$addressbookquery
->
execute
(
array
(
$this
->
uid
,
$row
[
'displayname'
],
$row
[
'uri'
],
$row
[
'description'
],
$row
[
'ctag'
]
)
);
$addressbookquery
->
execute
(
array
(
$this
->
uid
,
$row
[
'displayname'
],
$row
[
'uri'
],
$row
[
'description'
],
$row
[
'ctag'
]
)
);
// Map the id
// Map the id
$idmap
[
$row
[
'id'
]]
=
OCP\DB
::
insertid
();
$idmap
[
$row
[
'id'
]]
=
OCP\DB
::
insertid
(
'*PREFIX*contacts_addressbooks'
);
// Make the addressbook active
OC_Contacts_Addressbook
::
setActive
(
$idmap
[
$row
[
'id'
]],
true
);
}
}
// Now tags
// Now tags
foreach
(
$idmap
as
$oldid
=>
$newid
){
foreach
(
$idmap
as
$oldid
=>
$newid
){
...
@@ -51,7 +53,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
...
@@ -51,7 +53,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
$query
=
$this
->
content
->
prepare
(
"SELECT * FROM contacts_cards WHERE addressbookid LIKE ?"
);
$query
=
$this
->
content
->
prepare
(
"SELECT * FROM contacts_cards WHERE addressbookid LIKE ?"
);
$results
=
$query
->
execute
(
array
(
$oldid
)
);
$results
=
$query
->
execute
(
array
(
$oldid
)
);
while
(
$row
=
$results
->
fetchRow
()
){
while
(
$row
=
$results
->
fetchRow
()
){
// Import the
tags for this bookmark, using the new bookmark id
// Import the
contacts
$contactquery
=
OCP\DB
::
prepare
(
"INSERT INTO *PREFIX*contacts_cards (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)"
);
$contactquery
=
OCP\DB
::
prepare
(
"INSERT INTO *PREFIX*contacts_cards (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)"
);
$contactquery
->
execute
(
array
(
$newid
,
$row
[
'fullname'
],
$row
[
'carddata'
],
$row
[
'uri'
],
$row
[
'lastmodified'
]
)
);
$contactquery
->
execute
(
array
(
$newid
,
$row
[
'fullname'
],
$row
[
'carddata'
],
$row
[
'uri'
],
$row
[
'lastmodified'
]
)
);
}
}
...
...
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