Skip to content

Instantly share code, notes, and snippets.

View ciencia's full-sized avatar

Jesús Martínez Novo ciencia

View GitHub Profile
@ciencia
ciencia / ext-TimedMediaHandler-alphawebm-REL1_39.patch
Created March 13, 2024 22:04
patch MediaWiki extension TimedMediaHandler enable alpha transcodes REL1_39
diff --git a/includes/WebVideoTranscode/WebVideoTranscodeJob.php b/includes/WebVideoTranscode/WebVideoTranscodeJob.php
index df24861a..6849a0e9 100644
--- a/includes/WebVideoTranscode/WebVideoTranscodeJob.php
+++ b/includes/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -14,6 +14,7 @@ use FSFile;
use Job;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
+use MediaWiki\TimedMediaHandler\Handlers\WebMHandler\WebMHandler;
use MediaWiki\TimedMediaHandler\TimedMediaHandler;
@ciencia
ciencia / ext-TimedMediaHandler-autoplay-REL1_39.patch
Created March 13, 2024 22:01
patch MediaWiki extension TimedMediaHandler autoplay videos REL1_39
diff --git a/extension.json b/extension.json
index dc9cc247..d878a1ee 100644
--- a/extension.json
+++ b/extension.json
@@ -102,10 +102,12 @@
"CanonicalNamespaces": "main",
"FileDeleteComplete": "main",
"FileUpload": "main",
+ "GetPreferences": "main",
"ImageOpenShowImageInlineBefore": "main",
@ciencia
ciencia / extractwikiayoutubevideos.js
Created December 13, 2023 19:13
Extract youtube videos from wikia
/*
Execute in the browser's console
Extracts all videos from youtube in a json. The object is printed in the console, where you can "copy as object".
You may need to modify the category title
*/
(function() {
var _videoCollection = {},
_init = function() {
@ciencia
ciencia / cleanupUsersWithNoId.php
Last active June 21, 2023 18:08
cleanupUsersWithNoId.php REL1_35 uncyclopedia fixes
<?php
/**
* Cleanup tables that have valid usernames with no user ID
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ciencia
ciencia / MobileFrontend-reenableWgCategories.diff
Last active February 24, 2022 11:23
patch MediaWiki extension MobileFrontend reenable JS config var wgCategories on mobile
--- extensions/MobileFrontend/includes/MobileFrontendHooks.php 2022-02-24 11:13:19.276555994 +0000
+++ extensions/MobileFrontend/includes/MobileFrontendHooks.php 2022-02-24 11:14:40.725259992 +0000
@@ -1123,7 +1123,8 @@
$context = $services->getService( 'MobileFrontend.Context' );
if ( $context->shouldDisplayMobileView() ) {
$outreach = $services->getService( 'MobileFrontend.AMC.Outreach' );
- unset( $vars['wgCategories'] );
+ // Remove this to allow gadgets to work
+ //unset( $vars['wgCategories'] );
$vars['wgMFMode'] = $context->isBetaGroupMember() ? 'beta' : 'stable';
@ciencia
ciencia / ext-cookiewarning-displaydelay.diff
Created July 27, 2021 15:28
patch Extension:CookieWarning display delay
--- extensions/CookieWarning/resources/ext.CookieWarning/ext.CookieWarning.less 2021-07-27 13:47:14.732034066 +0000
+++ extensions/CookieWarning/resources/ext.CookieWarning/ext.CookieWarning.less 2021-07-27 15:24:20.621631670 +0000
@@ -9,6 +9,7 @@
z-index: 1999;
display: flex;
justify-content: center;
+ animation: mw-cookiewarning-fadein 3s; // WikiDex: delay display
// Narrow mobile screens
// 550px is a mostly arbitrary number, though it's used by a few other exts and skins
@ciencia
ciencia / opcache.php
Created April 16, 2021 15:36
opcache status - Script to get a nice visualization of opcache status (memory available, consumed, dirty...) I don't remember from where I grabbed it, but I haven't coded it
<?php
define('THOUSAND_SEPARATOR',true);
if (!extension_loaded('Zend OPcache')) {
echo '<div style="background-color: #F2DEDE; color: #B94A48; padding: 1em;">You do not have the Zend OPcache extension loaded, sample data is being shown instead.</div>';
require 'data-sample.php';
}
class OpCacheDataModel
@ciencia
ciencia / core-T278058_escape_message.diff
Created April 9, 2021 17:43
patch MediaWiki core 1.34 T278058 escape message
diff --git a/resources/src/mediawiki.rcfilters/ui/TagItemWidget.js b/resources/src/mediawiki.rcfilters/ui/TagItemWidget.js
index 5d45d18..ba7b920 100644
--- a/resources/src/mediawiki.rcfilters/ui/TagItemWidget.js
+++ b/resources/src/mediawiki.rcfilters/ui/TagItemWidget.js
@@ -94,7 +94,7 @@
).contents() );
} else {
this.setLabel(
- $( '<bdi>' ).append(
+ $( '<bdi>' ).text(
@ciencia
ciencia / core-T278014_escape_message.diff
Created April 9, 2021 17:42
patch MediaWiki core 1.34 T278014 escape message
diff --git a/includes/specials/SpecialNewFiles.php b/includes/specials/SpecialNewFiles.php
index 2c49e5f..d32313b 100644
--- a/includes/specials/SpecialNewFiles.php
+++ b/includes/specials/SpecialNewFiles.php
@@ -118,7 +118,7 @@
// mediastatistics-header-office, mediastatistics-header-text,
// mediastatistics-header-executable, mediastatistics-header-archive,
// mediastatistics-header-3d,
- return $this->msg( 'mediastatistics-header-' . strtolower( $type ) )->text();
+ return $this->msg( 'mediastatistics-header-' . strtolower( $type ) )->escaped();
@ciencia
ciencia / SyntaxHighlight-T276843-Vulnerable-lexers.diff
Created April 9, 2021 17:40
patch MediaWiki 1.34 extension SyntaxHighlight T276843 disable Vulnerable lexers
diff --git a/SyntaxHighlight.lexers.php b/SyntaxHighlight.lexers.php
index f64672e..968dd72 100644
--- a/SyntaxHighlight.lexers.php
+++ b/SyntaxHighlight.lexers.php
@@ -11,7 +11,8 @@
'ada' => true,
'ada2005' => true,
'ada95' => true,
- 'adl' => true,
+ // Disabled because of CVE-2021-27291