#1296: MediaWiki+FCKeditor : shared images not working
--------------------------------------------+-------------------------------
  Reporter:  cvh                            |       Owner:     
      Type:  Bug                            |      Status:  new
  Priority:  Normal                         |   Milestone:     
 Component:  Project : MediaWiki+FCKeditor  |     Version:     
Resolution:                                 |    Keywords:     
--------------------------------------------+-------------------------------
Comment (by cvh):

 To avoid the problem described,I tried to stop sharing the images and to
 create 2 totally independant wiki's.
 I made 2 folders: wikif & wikin, 2 databases: wikif & wikin.
 in the folders images of /wikin and /wikif I made a copy of the shared
 folder images (every images copied twice).
 Then I executed the script to create the image pages updating the tables
 page, revision and text.
 I managed to do it but I still had a problem: wiki could not find the text
 of the image pages. May be an error in my script or may be I forgot to
 take in account another table
 I place the script in attachment for your curiosity, any feedback is
 welcome.

 ----
 to understand this script:
 the database has been copied in db wikif and contains
 * without prefixe: the pool tables (containing image pages)
 * with prefixe fr_ the tables of the french wiki

 {{{
 /* insert image pages from the pool to the fr_ table */
         insert into wikif.fr_page
         (
          `page_namespace`, `page_title`, `page_restrictions`,
 `page_counter`, `page_is_redirect`, `page_is_new`, `page_random`,
 `page_touched`, `page_latest`, `page_len`
         )
         select
          `page_namespace`, `page_title`, `page_restrictions`,
 `page_counter`, `page_is_redirect`, `page_is_new`, `page_random`,
 `page_touched`, `page_latest`, `page_len`
         from wikif.page where page_namespace=6;

 select * from wikif.revision where rev_page in
         (select page_id from wikif.page where page_namespace=6);

 /** creation of the table to keep link between pool's page_id's and the
 pages i,serted in fr_page **/
 create temporary table wikif.tempage (page_id int, text_id int,
 new_page_id int);

 insert into wikif.tempage (page_id, text_id , new_page_id )
         select rev_page, rev_text_id ,0 from wikif.revision
         where rev_page in (select page_id from wikif.page where
 page_namespace=6);

 update wikif.tempage as t, fr_page as fp, page as ep
         set t.new_page_id= fp.page_id where fp.page_title=ep.page_title
 and t.page_id=ep.page_id;

 select * from wikif.tempage;

 CREATE TEMPORARY TABLE  wikif.temp_revision_table LIKE wikif.revision;

 insert into wikif.temp_revision_table select revision.* from
 wikif.revision
         join wikif.page on revision.rev_page=page.page_id where
 page_namespace=6;

 update wikif.temp_revision_table , wikif.tempage
         set rev_page= new_page_id where
 temp_revision_table.rev_page=tempage.page_id;

 select * from wikif.temp_revision_table;
 /********creation of new id's for fr_text******************/
 create temporary table wikif.temp_text (compteur int AUTO_INCREMENT
 PRIMARY KEY, old_id int , new_old_id int);

 insert into wikif.temp_text (old_id, new_old_id)
 SELECT text.old_id,0
 FROM wikif.text
 JOIN wikif.revision AS r ON text.old_id = r.rev_text_id
 JOIN wikif.page ON r.rev_page = page.page_id
 WHERE page_namespace =6
 order by old_id asc;

 create temporary table wikif.tempmax (maxi int);
 insert into wikif.tempmax (maxi) select max(old_id) from fr_text;

 select * from wikif.tempmax ;

 /** on va creer les nouveaux id de text **/
 update  wikif.temp_text, wikif.tempmax set new_old_id = maxi +compteur;
 select * from wikif.temp_text;

 /** we adapt the id from table text into temporary REVISION
 temp_revision_table **/
 update wikif.temp_revision_table , wikif.temp_text set rev_text_id=
 new_old_id where rev_text_id= old_id;
 select * from wikif.temp_revision_table;

 /** we add the texts with the new Id's and put it in a temporary table
 tempo; **/
 CREATE temporary TABLE wikif.tempo_text (
   `old_id` int(8) unsigned NOT NULL ,
   `old_text` mediumblob NOT NULL,
   `old_flags` tinyblob NOT NULL,
   PRIMARY KEY  (`old_id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci  ;

 insert into wikif.tempo_text
 select tt.new_old_id, t.old_text, t.old_flags from wikif.text as t join
 temp_text as tt on tt.old_id=t.old_id;
 select * from wikif.tempo_text;
 /** le stade final on va effectivement remplir la tables fr_text ******/

 insert into wikif.fr_text (old_id, old_text, old_flags)
 select old_id, old_text, old_flags from wikif.tempo_text;

 /** final stage we add the revisions fr_revision without the id ******/
 insert into wikif.fr_revision
 (rev_page, rev_text_id, rev_comment, rev_user, rev_user_text,
 rev_timestamp, rev_minor_edit,rev_deleted)
 select rev_page, rev_text_id,rev_comment, rev_user, rev_user_text,
 rev_timestamp, rev_minor_edit,rev_deleted from wikif.temp_revision_table;
 /* copy images in table fr_image **/
 delete from fr_image where img_name in (select distinct img_name from
 image);
 insert into fr_image select * from image;
 select * from fr_image;
 /*************************************************
 delete tables without prefixe (pool's table)

 ******************************************************/
 drop table archive  ;
 drop table categorylinks;
 drop table externallinks        ;
 drop table filearchive;
 drop table hitcounter;
 drop table image;
 drop table imagelinks;
 drop table interwiki;
 drop table ipblocks;
 drop table job;
 drop table langlinks;
 drop table logging;
 drop table math;
 drop table objectcache;
 drop table oldimage;
 drop table page;
 drop table pagelinks;
 drop table page_restrictions;
 drop table querycache;
 drop table querycachetwo;
 drop table querycache_info;
 drop table recentchanges;
 drop table redirect;
 drop table revision;
 drop table searchindex;
 drop table site_stats;
 drop table templatelinks;
 drop table text;
 drop table trackbacks;
 drop table transcache;
 drop table user;
 drop table user_groups;
 drop table user_newtalk;
 drop table watchlist
 }}}

-- 
Ticket URL: <http://dev.fckeditor.net/ticket/1296#comment:3>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to