Clip note to the DB field size (varchar64). Added more exclusions:

Sat, 17 Feb 2024 15:34:18 +0100

author
Peter Gervai <grin@grin.hu>
date
Sat, 17 Feb 2024 15:34:18 +0100
changeset 5
ff125aa259db
parent 4
aa3e6379dc3d
child 6
8b4e205ffc94

Clip note to the DB field size (varchar64). Added more exclusions:
- wikisources (requested)
- azwikimedia (suggested)
- gurwiki (broken SUL)
- gomwiktionary (broken SUL)

delinquent_files/shared.inc file | annotate | diff | comparison | revisions
--- a/delinquent_files/shared.inc	Sat Feb 17 15:30:43 2024 +0100
+++ b/delinquent_files/shared.inc	Sat Feb 17 15:34:18 2024 +0100
@@ -1,9 +1,7 @@
+#$Id$
+#
 <?PHP
 
-##
-## $Id$
-##
-
 # Wikipedia bot components
 require_once ( __DIR__.'/vendor/mediawiki-api/vendor/autoload.php' ) ;
 
@@ -59,29 +57,20 @@
 		if ( preg_match ( '/testwikidatawiki/' , $wiki  ) ) return true ;
 #		if ( preg_match ( '/^suwiki$/' , $wiki  ) ) return true ;
 		if ( preg_match ( '/usability/' , $wiki  ) ) return true ;
+
+		# wikisource
+		if ( preg_match ( '/sourceswiki/' , $wiki  ) ) return true ;
+		
 		# SUL LOGIN not working
 		if ( $wiki == 'donatewiki' ) return true ;
 	        if ( $wiki == 'idwikimedia' ) return true ;
-        	if ( $wiki == 'bdwikimedia' ) return true ;
+		if ( $wiki == 'bdwikimedia' ) return true ;
 		if ( $wiki == 'maiwikimedia' ) return true ;
 		if ( $wiki == 'amwikimedia' ) return true ;
 		if ( $wiki == 'gewikimedia' ) return true ;
-		
-		if ( $wiki == 'mniwiki' ) return true ;		# -grin 2022-02-05
-#		if ( $wiki == 'vecwiki' ) return true;		# -grin 2022-10-03
-
-		if ( $wiki == 'mnwwiktionary' ) return true ;	# -grin	2022-03-10
-		if ( $wiki == 'mniwiktionary' ) return true ;	# -grin	2022-03-10
-		if ( $wiki == 'shnwiktionary' ) return true ;   # -grin 2022-07-18
-		if ( $wiki == 'niawiktionary' ) return true ;   # -grin	2022-09-06
-
-		if ( $wiki == 'wawikisource' ) return true;	# -grin 2022-05-02
-		if ( $wiki == 'banwikisource' ) return true;     # -grin	2022-08-08
-
-#                if ( $wiki == 'fiwikivoyage' ) return true ;
-#                if ( $wiki == 'brwikisource' ) return true ;
-#                if ( $wiki == 'liwikibooks' ) return true ;
-#                if ( $wiki == 'liwikisource' ) return true ;
+		if ( $wiki == 'azwikimedia' ) return true ;
+		if ( $wiki == 'gurwiki' ) return true ;
+		if ( $wiki == 'gomwiktionary' ) return true;
 		return false ; // Wiki is OK
 	}
 	
@@ -103,7 +92,7 @@
 			$result = $this->runQuery ( $this->last_db , $sql ) ;
 			while($o = $result->fetch_object()) $ret = true ;
 		} catch (Exception $e) {
-	    		echo 'Caught exception: ',  $e->getMessage(), "\n";
+			echo 'Caught exception: ',  $e->getMessage(), "\n";
 		}
 		return $ret ;
 	}
@@ -113,6 +102,8 @@
 		$sql = "UPDATE event SET done=" . ($value*1) ;
 		if ( isset ( $meta ) ) {
 			if ( !is_array ( $meta ) ) $meta = array ( 'note' => $meta ) ;
+			# clip note to varchar(64)
+			if( isset($meta['note']) ) 	$meta['note'] = substr($meta['note'], 0, 63);
 			foreach ( $meta AS $k => $v ) {
 				$sql .= ",$k='" . $this->getDBsafe($v) . "'" ;
 			}

mercurial