diff --git a/l10n/mieti.php b/l10n/mieti.php index fac89ed..453787c 100755 --- a/l10n/mieti.php +++ b/l10n/mieti.php @@ -1,137 +1,136 @@ #!/usr/bin/php . # Usage: # ./mieti.php > trebbia.php require __DIR__ . '/../load.php'; empty( $argv ) and error_die("THIS FILE CAN SPAWN PHP CODE?!? RUN AWAY (╯°□°)╯"); $date = date( 'c' ); // header to be put in trebbia.php echo <<< EOF . # Last update: $date EOF; // end header spawn_gnu( Conference::T, [ Conference::TITLE, Conference::DESCRIPTION, ], Conference::UID ); spawn_gnu( Event::T, [ Event::TITLE, Event::SUBTITLE, Event::ABSTRACT, Event::DESCRIPTION, ], Event::UID ); spawn_gnu( Location::T, [ Location::NAME, Location::ADDRESS, Location::NOTE, ] ); spawn_gnu( Track::T, [ Track::NAME, Track::LABEL, ], Track::UID ); spawn_gnu( Chapter::T, [ Chapter::NAME ], Chapter::UID ); spawn_gnu( Room ::T, [ Room ::NAME ], Room ::UID ); spawn_gnu( Skill ::T, [ Skill ::TITLE ], Skill ::UID ); -spawn_gnu( User ::T, [ User ::BIO ], User ::UID ); // footer to be put in trebbia.php echo <<< EOF ###################################### ##### Th-th-th-that's all folks! ##### ###################################### EOF; // end footer function spawn_gnu( $from, $fields, $identifier = null ) { if( ! $identifier ) { $identifier = "{$from}_ID"; } // Stripping evil carriage returns from the database $cols = []; foreach( $fields as $field ) { $cols[] = new DBCol( $field, sprintf( 'REPLACE(`%1$s`, \'\r\n\', \'\n\')', $field ), '-' ); } query_update( $from, $cols, '1' /* WHERE 1 */ ); $results = Query::factory() ->select( $fields ) ->select( $identifier ) ->from( $from ) ->queryGenerator(); foreach( $results as $result ) { $uid = $result->get( $identifier ); spawn_linux( $from, $uid, $result, $fields ); } } function spawn_linux( $from, $uid, $obj, $properties ) { foreach( $properties as $property ) { $value = $obj->get( $property ); if( empty( $value ) ) { continue; } echo "\n\n"; printf( "// %s[%s]::%s\n", $from, $uid, $property ); $value = addcslashes( $value, '"\\' ); printf( '__("%s");', $value ); } }