[10:16:53] Christian Wiatr @Wladek92 posted in Blank lines appended to messages - https://discourse-mediawiki.wmflabs.org/t/blank-lines-appended-to-messages/1056/1 [13:21:01] Hi, we're trying to change the name of certain template elements based on the current language the user is using. I've already looked into the extensions and they're not what we're looking for. Can anyone point me in the right direction? [14:59:05] hello there, is there a reason why mediawiki emits "cache-control: private" headers even when not logged in? [15:03:03] & how can it be disabled? there's an option that does so but it involves enabling squid [15:21:38] juspog: what version of mediawiki are you running? [15:37:02] Skizzerz: 1.31 [15:40:36] excellent question, I'm seeing that too [15:47:02] unfortunately I don't have too much time right now to dig into why it's doing that :( [15:49:23] Skizzerz: i searched for "no-revalidate" through the mediawiki github repo but couldn't find anything useful. it's not a dealbreaker because i can override those headers in nginx/cloudflare, but it would make sense that unlogged requests have at least "public" so it plays nice with other caching system [15:50:07] yeah reason I asked about version is that older versions used to show your ip address in the page header (top right where the log in/register link is), and that would prevent public caching [15:50:10] but that's been long since removed [15:51:07] Technical Advice IRC meeting starting in 10 minutes in channel #wikimedia-tech, hosts: @addshore & @CFisch_WMDE - all questions welcome, more infos: https://www.mediawiki.org/wiki/Technical_Advice_IRC_Meeting [15:57:07] i remember that, one of the first things i disabled to use the cache :) [17:00:08] mediawiki doesn't add cache-control: private to pages [17:00:32] unless you have a session, it's an error page, the content object requests it etc [17:01:09] OutputPage::sendCacheControl is where most of the relevant logic lives [17:01:29] Skizzerz: ^ [18:02:49] Hello tgr [18:03:13] hi raghavendra [18:03:41] As we have discussed about this yesterday is there still something I'm missing [18:03:41] sed -i 'http\:\/\/\(www\.)?mediawiki\.org$/https\:/\/(www\.)\?mediawiki\.org/g' *.php [18:05:47] Surely, all MW http links have already been mass replaced at this point? [18:06:10] raghavendra: That snippet only does the current directory, you would probably want it to recurse if you were actually doing a mass string replace [18:06:27] Still I found many in many extensions [18:06:41] Also, make sure you don't change any urls that need to stay (For example, namespaces cannot change protocol) [18:06:45] raghavendra: looks good at a glance [18:07:04] but this is not working in my case [18:07:04] if you are not confident you can use something like https://regex101.com/ to test it [18:08:07] yeah /me checking [18:09:51] that site is not sed compatible so you'd have to separate the regex and the replacement string; there are probably other ones [18:10:16] oh btw you put a bunch of regex notation in the replace string, that's not going to work [18:10:22] yeah I'm trying [18:11:07] you need something along the lines of https://$1mediawiki.org [18:11:51] Well also, ? isn't supported in sed regexes i think [18:12:05] without the -E flag [18:13:56] I guess this should work now [18:13:56] sed -i 's/http:\/\/www\.mediawiki\.org/https:\/\/www\.mediawiki\.org/g' [18:14:03] I'm trying out [18:14:58] honestly, I'd just go with the search/replace of whatever text editor / IDE you are using [18:15:20] easier to use and you can confirm the changes one by one which is something you'll need to do anyway [18:16:06] Hello raghavendra I think you have missed something like *.php or something? [18:16:59] Gopa: Ooh yes I forgot [18:17:27] tgr: umm too dificult to make a huge no.of lines [18:18:14] you shouldn't change a huge number of lines without reviewing what you are changing, anyway [18:18:30] yeah true, makes sense. [18:22:04] Thanks Gopa and tgr [18:24:19] raghavendra: Is that command working fine now ? [18:25:33] I mean `sed -i 's/http:\/\/www\.mediawiki\.org/https:\/\/www\.mediawiki\.org/g' *.php` [18:26:30] Yes Gopa this is working now and all the http is changed into https now, but this is limited to the one directory. [18:28:45] Nice ;) [18:30:50] This something looks like https://phabricator.wikimedia.org/T189687 Feel free to submit patches If you are interested :) [18:35:17] Yea how to change in all the directrories using sed as recurssion ? [18:37:43] Gopa: tgr ? [18:37:54] tgr: [18:38:53] umm, Sorry raghavendra I'm not sure about that :( [18:40:31] find . -name '*.php' | xargs sed -i '...' or something like that? [18:40:44] I still think it's a bad idea to use sed for that [19:28:21] almost entirely unrelated; in s/this/that/ you don't need to use /. it'll use whatever character follows the 's' as the separator. sed 's|http://www.mediawiki.org/|https://www.mediawiki.org/|g' is much more readable (and much less error-prone) [19:29:10] (I'm not saying that's the right time to use sed. Just that when I discovered I didn't have to type \/\/\/\/, I wished someone had told me earlier) [21:20:59] shauno: an information worth spreading indeed, but personally I prefer to use less "special" characters as a lowly comma [21:22:16] (Could be relevant for this channel as pipes are kinda important in wikitext.)