Pengguna:HsfBot/Arsip otomatis: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
→‎Contoh 1: Arsip statis: // Edit via Wikiplus
Tidak ada ringkasan suntingan
Baris 1:
{{Notice|Halaman instruksi ini didasarkan pada [[:en:User:Lowercase sigmabot III/Archive HowTo]].}}
{{Documentation subpage}}
<!--
<!-- Masukan kategori pada bagian bawah yang sudah ditandai di halaman ini. Untuk interwiki gunakan Wikidata (lihat [[Wikipedia:Wikidata]]) -->
: (For similar bots, see [[:Category:Wikipedia archive bots]].)
==== Contoh 1: Arsip statis ====
-->
{{Warning|Paling sederhana, kemungkinan bukan pilihan terbaik - contoh ke-2 lebih sering digunakan.}}
{{Warning|Sebelum menyiapkan pengarsipan otomatis di halaman pembicaraan artikel, mohon buat konsensus bahwa pengarsipan benar-benar dibutuhkan di sana.}}
 
=== Menyiapkan pengarsipan ===
Letakkan templat berikut di bagian paling atas halaman yang ingin Anda arsipkan secara otomatis:
 
{{Warning|Kode di bawah tidak akan bekerja -lihat contoh untuk mengisis opsi yang sesuai-}}
 
<pre style="overflow: auto">
{{User:HsfBot/config
| algo = old(...)
| archive = Nama halaman arsip: Untuk menghasilkan beberapa halaman dari waktu ke waktu, gunakan variabel, yang dijelaskan di bawah ini.
[parameter lain - ***baca di bawah ini***]
}}
</pre>
<!--
Well, maybe '''not exactly''' that (read about required options below), but that's how it's done. By the way, [[User:HsfBot/config|the template]] has '''no content''' and is sysop-'''protected''', so don't worry about visual appearance. :)
-->
Bot hanya mengenali satu parameter per baris. Penutupan }} harus berada pada baris tersendiri. Tidak boleh ada spasi sebelum pipa (|). Jika Anda mengeluarkan data baru yang digunakan pada contoh di atas, mis. Dengan meringkas pemanggilan templat ke satu baris, bot mungkin tidak melakukan apa yang Anda harapkan.
 
Selain itu, templat harus ditempatkan:
# sebelum header == tingkat kedua == pertama di halaman
# pada halaman sebenarnya dan tidak ditransklusikan dari subhalaman, seperti header halaman, templat, dll.
 
=== Contoh cepat ===
Untuk mengatasinya - konfigurasi mungkin tidak intuitif, tapi fleksibel dan berpotensi memberikan kemungkinan besar.
 
:<span style="color:darkred;">'''Silahkan ganti "''Pembicaraan pengguna:Contoh''" ke nama '' tepatnya '' dari halaman Anda sendiri!'''</span>
:<span style="color:darkgreen;">'''Jika masih tidak berfungsi, baca tentang parameter '''minthreadsleft''' dan'' 'minthreadstoarchive''' di bawah ini.'''</span>
 
==== Contoh 1: arsip statis ====
{{Warning|Sementara yang paling sederhana, ini mungkin bukan pilihan terbaik - contoh kedua adalah yang paling umum.}}
 
<pre style="overflow: auto">
{{User:HsfBot/config
| algo = old(7d)
| archive = UserPembicaraan talkpengguna:Example/Archive
}}
</pre>
 
Pengaturan ini mengarsipkan untaianbenang dari [[Pembicaraan pengguna:ContohExample]] ke [[Pembicaraan pengguna:contoh Example /Arsip Archive]] setelah berumur 7 hari (dihitungterhitung dari ''jejak-cap waktu'' terakhirterbaru). Arsip '' 'mungkin akan ''crush''membeku jikasaat sudahmenjadi menumpuk2000KB lebihbesar' dari 2000KB'''. Ini mungkinMungkin bukan konfigurasi yang disarankansangat berguna (kecuali untuk mengirimkanmengirim untaianbenang ke halamantempat sampah ''sampah'' yang secaratelah periodikdibersihkan dihapus,secara berkala atau untuk menentukan sendiri kapan diperlukanAnda pemindahanharus pergi ke halaman arsip berikutnya), tapi ini yang paling mudah, jadi saya menyebutkannya terlebih dulu.
 
==== Contoh 2: Arsip berkesinambungan ====
== Penggunaan ==
<pre style="overflow: auto">
Tambahkan templat berikut di bagian paling atas halaman yang akan diarsipkan:
{{User:HsfBot/config
<pre><nowiki>
| algo = old(30d)
{{Pengguna:Hsfbot/config
| archive = Pembicaraan pengguna:Example/Archive %(counter)d
|algo counter = =1
|counter maxarchivesize = =150K
| archiveheader = {{Automatic archive navigator}}
|maxarchivesize =
| minthreadstoarchive = 1
|minthreadsleft =
| minthreadsleft = 4
|minthreadstoarchive =
|archiveheader =
|key =
}}
</nowiki></pre>
{{Hst|reason=copy dan paste agar mudah digunakan}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<pre style="overflow: auto">
<!-- Tambahkan kategori dibawah baris ini, untuk interwiki gunakan Wikidata -->
{{User:HsfBot/config
| algo = old(30d)
| archive = {{SUBST:FULLPAGENAME}}/Archive %(counter)d
| counter = 1
| maxarchivesize = 150K
| archiveheader = {{Automatic archive navigator}}
| minthreadstoarchive = 1
| minthreadsleft = 4
}}
</pre>
{{Hsb}}
Ini memberitahu bot untuk mengarsipkan benang lebih dari tiga puluh hari (meninggalkan yang keempat terakhir) dari [[Pembicaraan pengguna: Contoh]] ke [[Pembicaraan pengguna: Contoh / Arsip 1]] (lebih lanjut tentang variabel [[#Variables | below] ]) sampai mengisi sampai 150 kilobyte, lalu bot akan berpindah ke 2 (memperbarui meja saat menyimpan halaman). Ingatlah untuk '' 'tentukan ukuran maksimum' '' arsip, atau akan berperilaku cukup banyak seperti pada contoh pertama. Selain itu, setiap halaman arsip diberi banner {{Tl|Aan}}, yang memudahkan untuk berpindah di antara halaman arsip yang berbeda.
 
==== Contoh 3: arsip berbasis tanggal ====
{{Warning|'''Jangan''' mengganti "year" dan "monthname" dengan nilai sebenarnya - bot akan memperlakukannya sebagai variabel yang sesuai.}}
 
<pre style="overflow: auto">
{{User:HsfBot/config
| algo = old(5d)
| archive = Pembicaraan pengguna:Example/Archives/%(year)d/%(monthname)s
| archiveheader = {{MonthlyArchive}}
}}
</pre>
{{Hst|reason=copy and paste for easy use}}
<pre style="overflow: auto">
{{User:HsfBot/config
| algo = old(5d)
| archive = {{SUBST:FULLPAGENAME}}/%(year)d/%(monthname)s
| archiveheader = {{MonthlyArchive}}
}}
</pre>
{{Hsb}}
Dalam konfigurasi ini, topik yang lebih tua dari 5 hari akan mendarat di arsip tergantung tanggalnya (yaitu ''timestamp'' terbaru). Anda bisa membaca tentang variabel lain [[#Variable|dibawah]].
 
=== Penjelasan parameter ===
<pre>
{{User:HsfBot/config
| archive =
| algo =
| counter =
| maxarchivesize =
| minthreadsleft =
| minthreadstoarchive =
| archiveheader =
| key =
}}
</pre>
 
{| class = "wikitable"
! Parameter || Default || Description
|-
| <kbd>archive</kbd> || N/A; required || Name of the page to which archived threads will be put. This parameter supports the use of [[#Variables|variables]], which can be used to create dynamically named archives (such as using date ranges). Note that magic words and templates do not work with this parameter, and unless a <kbd>key</kbd> is supplied (see below), the target page must be a subpage of the current page.
|-
| <kbd>algo</kbd> || <kbd>old(24h)</kbd> || Algorithm that instructs the bot how to decide whether to archive a thread or not. Complex formulas (including regex matching) will be available in the future, but so far it '''must''' be of the form '''<kbd>old(...)</kbd>''' where '''...''' specifies the maximum age of a thread (in hours or days: ''24h'', ''72h'', ''5d'', ''21d'', etc.).
|-
| <kbd>counter</kbd> || <kbd>1</kbd> || The current number of the last archive. If the <kbd>%(counter)d</kbd> variable is not used, it is ignored. Lowercase sigmabot III will update this parameter as necessary.
|-
| <kbd>maxarchivesize</kbd> || <kbd>1954K</kbd> || The maximum archive size in either raw text size (eg <kbd>256M</kbd> for megabytes, <kbd>256K</kbd> for kilobytes, or <kbd>256B</kbd> for bytes) or threads (eg <kbd>10T</kbd>) before incrementing the counter. A bare integer will be interpreted as bytes. Ignored if counter is not used.
|-
| <kbd>minthreadsleft</kbd> || <kbd>5</kbd> || The minimum number of threads that should be left on a page (to prevent pages from getting completely harvested).
|-
| <kbd>minthreadstoarchive</kbd> || <kbd>2</kbd> || The minimum number of threads to archive at one time, which is used to lower edit frequency. lowercase sigmabot III will not archive threads when fewer than the value of this parameter would be archived.
|-
| <kbd>archiveheader</kbd> || <kbd>{{Tl|Talk archive}}</kbd> || Content that will be put on new archive pages as the header. This parameter supports the use of [[#Variables|variables]].
|-
| <kbd>key</kbd> || || A top-secret key that (if valid) allows archives to ''not'' be subpages of the page being archived. To obtain such a key, [[Pembicaraan pengguna:Σ|request it from&nbsp;this&nbsp;editor]], and you better have a ''very'' good justification for doing so.
|}
 
=== Variables ===
{| class = "wikitable"
! Variable parameter || Expands to...
|-
| <kbd>%(counter)d</kbd> || the current value of the <kbd>counter</kbd>
|-
| <kbd>%(year)d</kbd> || year of the thread being archived
|-
| <kbd>%(month)d</kbd> || month (as a number 1-12) of the thread being archived
|-
| <kbd>%(monthname)s</kbd> || English name of the month above
|-
| <kbd>%(monthnameshort)s</kbd> || first three letters of the name above
|}
 
Those [[python (programming language)|python]]-savvy people will immediately recognize these variables are filled at runtime with the <kbd>%</kbd> operator and should know how to adjust the format. A few points of interest to others:
*make sure you don't mess up the last letter after the brackets (it's "d" for [[integer]]s and "s" for [[string (computer science)|strings]])
*integer variables may be left-padded with zeros:
*:<kbd>%(counter)03d</kbd> evaluates to <kbd>013</kbd> if the <kbd>counter</kbd>'s value equals 13,
*:<kbd>%(month)02d</kbd> becomes <kbd>05</kbd> for May etc.
 
=== After you have set up archiving ===
The bot runs once a day at a preset hour, or twice a day for [[WP:Administrators' Noticeboard|WP:AN]] and [[Wikipedia:Administrators' noticeboard/Incidents|WP:AN/I]]. Simply wait for the next cycle and you should see the bot's entries in the history list of your article '''providing''' there was anything to archive, and the history list entry should provide a link to the archive page you specified.<br />
 
Various [[WP:TM|templates]] will produce an automatic list of archive subpages. Typically, such a template will be added to the top-level talk page to make archives easier to find. Simply add the template name in <code><nowiki>{{curly-braces}}</nowiki></code> where you want it to appear. Popular templates used for this purpose include:
* {{Tlx|Automatic archive navigator}}
* {{Tlx|Archive box}}
* {{Tlx|archives}}
* {{Tlx|MonthlyArchive}}. If you use [[#Example 3 - date-based archives]], use this with <code>root = Pembicaraan pengguna:Example/Archives</code>.
* {{Tlx|Talk header}} (this template has other functions, but can include a list of archives and a search box)
 
=== Delaying or preventing archiving of particular threads ===
Archiving can be delayed for a particular thread by substituting the template {{tl|DNAU}} into the thread. Use <code><nowiki>{{subst:DNAU}}</nowiki></code> to retain a thread indefinitely, or <code><nowiki>{{subst:DNAU|<integer>}}</nowiki></code> to retain a thread for <integer> days. see the template documentation for details about its use and function.
 
{{Warchivenav|state=uncollapsed}}<noinclude>
 
[[fi:Käyttäjä:HarrivBOT/config]]</noinclude>
}}</includeonly>